adding records thru OLE DB

adding records thru OLE DB

Post by M Maso » Tue, 23 Nov 1999 04:00:00



Does anyone know of any problems or how to add records to a SQL 7 server
through VC 6. I've set up SQL 7 with OLE DB using the ODBC connection, it
connects just fine, I can scroll thru the data and even delete. Just not add
a record. I have rights on SQL 7 and on my application. I've even used the
trace in SQL and the insert command goes to SQL except in inserts nothing.

I've setup this same app. with MS Access and MS Jet, and it works just fine,
except I've had the same timing problems some of the NG memebers mentioned
earlier.

Michael

 
 
 

adding records thru OLE DB

Post by Bob Beauchemi » Tue, 23 Nov 1999 04:00:00


    Hi Mike,
    You mean you can't insert a record using ICommand::Execute and an insert
statement?? ie:

CCommand<CNoAccessor, CNoRowset> cmd;
cmd.Open(session, "insert mytable values(1,2,3)");

    or  you can't insert through a rowset, ie:

CCommand<CAccessor<CAuthors>, CRowset> cmd;
CDBPropSet (DBPROPSET_ROWSET);
// set properties for updatable/insertable rowset
cmd.Open(session, "select * from authors");
// fill in member variables in user-record class
cmd.Insert();

    If its the second case, do you have an identity column in your
accessor/user record class??
    If not, post more details...

Bob Beauchemin


> Does anyone know of any problems or how to add records to a SQL 7 server
> through VC 6. I've set up SQL 7 with OLE DB using the ODBC connection, it
> connects just fine, I can scroll thru the data and even delete. Just not
add
> a record. I have rights on SQL 7 and on my application. I've even used the
> trace in SQL and the insert command goes to SQL except in inserts nothing.

> I've setup this same app. with MS Access and MS Jet, and it works just
fine,
> except I've had the same timing problems some of the NG memebers mentioned
> earlier.

> Michael