🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages Started by bill Fri, 15 Jun 2007 19:04
adoquery error
#204
Author: bill
Date: Fri, 15 Jun 2007 19:04
14 lines
1517 bytes
i have a very strange problem when executing a sql query from an adoquery
i want to execute:
"Insert into table1 values ('abc','def','ghj')"
this sql statement is executed perfectly when i run it from the database 
(sql server). if i put it in the
adoquery properties sql it is executed successfully too. but if i do:
DataModule1->ADOQuery1->SQL->CommaText="Insert into table1 values 
('abc','def','ghj')";
DataModule1->ADOQuery1->ExecSQL();
i get an error "syntax error near def". from many tests i came to realize 
that the problem is the comma after the 'abc'.
how can i solve this issue?

thank you 
Re: adoquery error
#205
Author: bill
Date: Fri, 15 Jun 2007 19:46
24 lines
1986 bytes
sorry for the post the solutions lies in the ansistring to widestring ,it 
works if i do it like:
AnsiString sql="...";
DataModule1->ADOQuery->SQL->ADD(WideString(sql.c_str()));
sorry for the post ,thanks


"bill" <billaras1234@hotmail.com> wrote in message 
news:4672e2bd@newsgroups.borland.com...
>i have a very strange problem when executing a sql query from an adoquery
> i want to execute:
> "Insert into table1 values ('abc','def','ghj')"
> this sql statement is executed perfectly when i run it from the database 
> (sql server). if i put it in the
> adoquery properties sql it is executed successfully too. but if i do:
> DataModule1->ADOQuery1->SQL->CommaText="Insert into table1 values 
> ('abc','def','ghj')";
> DataModule1->ADOQuery1->ExecSQL();
> i get an error "syntax error near def". from many tests i came to realize 
> that the problem is the comma after the 'abc'.
> how can i solve this issue?
>
> thank you
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads