Click here to Skip to main content
15,896,726 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: IOCTL codes Pin
Roger Stoltz30-Jun-09 1:25
Roger Stoltz30-Jun-09 1:25 
QuestionCMYK values Pin
S p k 52129-Jun-09 20:56
S p k 52129-Jun-09 20:56 
AnswerRe: CMYK values Pin
Nuri Ismail29-Jun-09 21:19
Nuri Ismail29-Jun-09 21:19 
GeneralRe: CMYK values Pin
S p k 52129-Jun-09 21:57
S p k 52129-Jun-09 21:57 
GeneralRe: CMYK values Pin
Nuri Ismail29-Jun-09 22:04
Nuri Ismail29-Jun-09 22:04 
AnswerRe: CMYK values Pin
Chris Losinger30-Jun-09 10:24
professionalChris Losinger30-Jun-09 10:24 
GeneralRe: CMYK values Pin
Nuri Ismail30-Jun-09 20:42
Nuri Ismail30-Jun-09 20:42 
AnswerRe: CMYK values Pin
Alan Balkany1-Jul-09 4:14
Alan Balkany1-Jul-09 4:14 
QuestionDebug Assertion Pin
Davitor29-Jun-09 20:42
Davitor29-Jun-09 20:42 
AnswerRe: Debug Assertion Pin
Madhu Nair29-Jun-09 20:59
Madhu Nair29-Jun-09 20:59 
GeneralRe: Debug Assertion Pin
Davitor29-Jun-09 21:12
Davitor29-Jun-09 21:12 
AnswerRe: Debug Assertion Pin
«_Superman_»29-Jun-09 21:07
professional«_Superman_»29-Jun-09 21:07 
GeneralRe: Debug Assertion Pin
Davitor29-Jun-09 21:14
Davitor29-Jun-09 21:14 
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 

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.