Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with CommandText concatenation - Visual C++

4 views
Skip to first unread message

Jim

unread,
May 6, 2006, 11:08:09 AM5/6/06
to
Hi everyone,

I'm trying to assign a command to an OleDbCommand object and
concatenate a string parameter without much success. Here's a basic
idea of what I'm trying to do for my school project against an Access
db.


string sCmd;
OleDbCommand * cmd = new OleDbCommand();


sCmd = "INSERT INTO Books (Title) VALUES (' " + dbFile.Title;
//dbFile.Title is also a string
cmd->CommandText = sCmd;


I then get the following error:
error C2664: 'System::Data::OleDb::OleDbCommand::set_CommandText' :
cannot convert parameter 1 from 'std::string' to 'System::String __gc
*'


Any help would be greatly appreciated.


Thanks!

0 new messages