Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Debug Assertion Pin
CPallini29-Jun-09 21:37
mveCPallini29-Jun-09 21:37 
GeneralRe: Debug Assertion Pin
Davitor29-Jun-09 21:51
Davitor29-Jun-09 21:51 
GeneralRe: Debug Assertion Pin
CPallini29-Jun-09 21:56
mveCPallini29-Jun-09 21:56 
GeneralRe: Debug Assertion Pin
Davitor29-Jun-09 22:08
Davitor29-Jun-09 22:08 
AnswerRe: Debug Assertion Pin
Stuart Dootson29-Jun-09 22:32
professionalStuart Dootson29-Jun-09 22:32 
GeneralRe: Debug Assertion Pin
Davitor29-Jun-09 23:05
Davitor29-Jun-09 23:05 
GeneralRe: Debug Assertion Pin
CPallini29-Jun-09 23:34
mveCPallini29-Jun-09 23:34 
GeneralRe: Debug Assertion [modified] Pin
Stuart Dootson30-Jun-09 2:27
professionalStuart Dootson30-Jun-09 2:27 
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

GeneralRe: Debug Assertion Pin
Davitor30-Jun-09 20:53
Davitor30-Jun-09 20:53 
GeneralRe: Debug Assertion Pin
Davitor8-Jul-09 18:16
Davitor8-Jul-09 18:16 
GeneralRe: Debug Assertion Pin
Stuart Dootson9-Jul-09 0:31
professionalStuart Dootson9-Jul-09 0:31 
QuestionHow to handle VSFlexGrid's OnPaste event ? Pin
prasadgates29-Jun-09 20:29
prasadgates29-Jun-09 20:29 
AnswerRe: How to handle VSFlexGrid's OnPaste event ? Pin
Madhu Nair29-Jun-09 22:30
Madhu Nair29-Jun-09 22:30 
AnswerRe: How to handle VSFlexGrid's OnPaste event ? Pin
ThatsAlok30-Jun-09 0:47
ThatsAlok30-Jun-09 0:47 
QuestionQuerry!! Pin
Razanust29-Jun-09 20:20
Razanust29-Jun-09 20:20 
AnswerRe: Querry!! Pin
Chandrasekharan P29-Jun-09 20:30
Chandrasekharan P29-Jun-09 20:30 
AnswerRe: Querry!! Pin
Razanust29-Jun-09 20:37
Razanust29-Jun-09 20:37 
AnswerRe: Querry!! [modified] Pin
Harsh Shankar29-Jun-09 21:40
Harsh Shankar29-Jun-09 21:40 
AnswerRe: Querry!! Pin
Michael Schubert29-Jun-09 21:41
Michael Schubert29-Jun-09 21:41 
GeneralRe: Querry!! Pin
Harsh Shankar29-Jun-09 22:44
Harsh Shankar29-Jun-09 22:44 
GeneralRe: Querry!! Pin
Michael Schubert29-Jun-09 23:03
Michael Schubert29-Jun-09 23:03 
GeneralRe: Querry!! Pin
Harsh Shankar29-Jun-09 23:12
Harsh Shankar29-Jun-09 23:12 
GeneralRe: Querry!! Pin
Michael Schubert29-Jun-09 23:29
Michael Schubert29-Jun-09 23:29 
AnswerRe: Querry!! Pin
Rajesh R Subramanian29-Jun-09 22:35
professionalRajesh R Subramanian29-Jun-09 22:35 
AnswerRe: Querry!! Pin
Aric Wang29-Jun-09 23:27
Aric Wang29-Jun-09 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.