When using the MFC class CDatabase to connect to a data source, is there any way to execute SQL statements without having to open a CRecordSet object? I ask because CRecordSet::Open() appears to throw an exception when I use it to call stored procedures that don't return anything - and there's no reason to expect results from, say, sp_
delete_
row.
views:
370answers:
2
+2
A:
I use CDatabase::ExecuteSQL()
CDatabase database;
//database is connected somewhere
database.ExecuteSql("Drop table [users]"); // sql statement from little Johnny Drop tables
BrianK
2009-06-17 02:50:33
Don't have time to test this at the moment, but it looks like the right thing so I'm accepting it on trust. Thanks very much.His name was Bobby, not Johnny, by the way.
Tommy Herbert
2009-06-18 10:50:24
touche - Bobby is right.
BrianK
2009-06-19 00:03:03