Debug Assertion
-
See if this [^] helps. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi CPallini Thanks for reply.may i know where is concept of my question in your post?Plz help me
It looks like you've to change the flag
"Ignore # in table name"
in your ODBC driver in order to make the statement 'SHOW DATABASES
' work. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
It looks like you've to change the flag
"Ignore # in table name"
in your ODBC driver in order to make the statement 'SHOW DATABASES
' work. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]So i change
CString szSql = "SHOW DATABASES"; to this
szSql = "SHOW DATABASES from mysql",or
rs.Open( CRecordset::forwardOnly, szSql); to this
rs.Open( _T("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=;User=root; Password=root;Option=3;"),szSql,CRecordset::forwardOnly);Both are givesame debug assertion. Plz help me
-
Hi All I am geting debug assertion failed Line 3232 in file dbcore.cpp.Code is here
Database database;
try
{
if(database.OpenEx(_T("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=;User=root; Password=root;Option=3;"), CDatabase::noOdbcDialog))
{
AfxMessageBox("Connection Successfully");CString szSql = "SHOW DATABASES";
CRecordset rs(&database);
rs.Open( CRecordset::forwardOnly, szSql);while (!rs.IsEOF())
{
CString szBuf;rs.GetFieldValue("DATABASE", szBuf);
rs.MoveNext();
}rs.Close();
} } catch(CException \*e) { AfxMessageBox("Connection Failed"); }
i am geting assertion in this line
rs.Open( CRecordset::forwardOnly, szSql);
Debug assertion failed Line 3232 in file dbcore.cpp.I see line 3232 in dbcore.cpp file.There i found this syntax
ASSERT(m_nFields != 0);
Can any one tell how can i solve that debug assertion. Plz help me
Ummmmm - "SHOW DATABASES" isn't SQL? It IS a MySQL command - but that doesn't necessarily make it something you can execute using ODBC?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Ummmmm - "SHOW DATABASES" isn't SQL? It IS a MySQL command - but that doesn't necessarily make it something you can execute using ODBC?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
yaa i know "SHOW DATABASE" is Mysql command and i am useing for MySql.Can you tell how and which command is execute for SHOW DATABASE useing ODBC? Plz help me
You may try '
SHOW SCHEMA
', it looks like more 'SQL
standard'. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
yaa i know "SHOW DATABASE" is Mysql command and i am useing for MySql.Can you tell how and which command is execute for SHOW DATABASE useing ODBC? Plz help me
Don't think you can use CRecordset - I don't think it lets you execute arbitrary commands. You could use CDatabase::ExecuteSQL - but that doesn't return any results. You can use ODBC to execute that command - here's how you'd do it in Python
import dbi
import odbc
conn = odbc.odbc("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;")
curs = conn.cursor()
curs.execute("SHOW DATABASES")
curs.fetchall()results in something like this
[('information_schema',), ('mysql',), ('test',)]
Here's how you could do it in C++ with ADO:
#import "libid:2A75196C-D9EB-4129-B803-931327F72D5C" rename("EOF", "adoEOF")
int main()
{
CoInitialize(0);
ADODB::_ConnectionPtr conn(__uuidof(ADODB::Connection));
conn->Open(_bstr_t("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;"), "", "", 0);
ADODB::_RecordsetPtr rs = conn->Execute(_bstr_t("SHOW DATABASES"), 0, ADODB::adCmdText);_variant_t databaseNames = rs->GetRows(ADODB::adGetRowsRest);
}databaseNames
is a SAFEARRAY containing BSTR elements, one for each database name.
Last modified: 3hrs 14mins after originally posted --
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Don't think you can use CRecordset - I don't think it lets you execute arbitrary commands. You could use CDatabase::ExecuteSQL - but that doesn't return any results. You can use ODBC to execute that command - here's how you'd do it in Python
import dbi
import odbc
conn = odbc.odbc("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;")
curs = conn.cursor()
curs.execute("SHOW DATABASES")
curs.fetchall()results in something like this
[('information_schema',), ('mysql',), ('test',)]
Here's how you could do it in C++ with ADO:
#import "libid:2A75196C-D9EB-4129-B803-931327F72D5C" rename("EOF", "adoEOF")
int main()
{
CoInitialize(0);
ADODB::_ConnectionPtr conn(__uuidof(ADODB::Connection));
conn->Open(_bstr_t("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;"), "", "", 0);
ADODB::_RecordsetPtr rs = conn->Execute(_bstr_t("SHOW DATABASES"), 0, ADODB::adCmdText);_variant_t databaseNames = rs->GetRows(ADODB::adGetRowsRest);
}databaseNames
is a SAFEARRAY containing BSTR elements, one for each database name.
Last modified: 3hrs 14mins after originally posted --
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Don't think you can use CRecordset - I don't think it lets you execute arbitrary commands. You could use CDatabase::ExecuteSQL - but that doesn't return any results. You can use ODBC to execute that command - here's how you'd do it in Python
import dbi
import odbc
conn = odbc.odbc("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;")
curs = conn.cursor()
curs.execute("SHOW DATABASES")
curs.fetchall()results in something like this
[('information_schema',), ('mysql',), ('test',)]
Here's how you could do it in C++ with ADO:
#import "libid:2A75196C-D9EB-4129-B803-931327F72D5C" rename("EOF", "adoEOF")
int main()
{
CoInitialize(0);
ADODB::_ConnectionPtr conn(__uuidof(ADODB::Connection));
conn->Open(_bstr_t("Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=; User=root; Password=password; Option=3;"), "", "", 0);
ADODB::_RecordsetPtr rs = conn->Execute(_bstr_t("SHOW DATABASES"), 0, ADODB::adCmdText);_variant_t databaseNames = rs->GetRows(ADODB::adGetRowsRest);
}databaseNames
is a SAFEARRAY containing BSTR elements, one for each database name.
Last modified: 3hrs 14mins after originally posted --
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Hi Stuart Dootson This things is working fine.But i need to use "Select * from Tablename".Show how can i get full information of table in
_variant_t.
Plz help me