Insert SQL statements into a DB record using Command object?

Insert SQL statements into a DB record using Command object?

Post by Sarah Smit » Thu, 17 Jun 2004 18:19:43


Hello,

I'm porting a VB6 / ADO application to VB/ADO.net and I'm running into
some ADO.Net problems.

I have a system that allows users to write and test their own SQL
statements, and then save them to the SQL Server in a table called
AdHoc.

(They are not allowed to use certain destructive statements such as
DROP, DELETE)

When they are happy with the results of the query, they save the SQL,
and a short menu text into the database. They can then select and run
the query they created by choosing it from a combo box (using the menu
text).

This was never a problem in ado classic, but when I use an ADO.net
command object and call the .ExecuteNoneQuery method, it seems that
the SQL statements I want to add or update in the database, are
getting mixed up in the SQL Insert or Update statements that actually
do the saving/updating of the database.

So I guess my question is: how can I execute an SQL statement that has
string fields, that contain SQL statements themselves.

Anyone?

ss.
 
 
 

Insert SQL statements into a DB record using Command object?

Post by Cor Ligthe » Thu, 17 Jun 2004 19:35:41

Hi Sarah,

You do not show how you do it, however do you use this class?

http://www.yqcomputer.com/

Cor

 
 
 

Insert SQL statements into a DB record using Command object?

Post by Sarah Smit » Thu, 17 Jun 2004 21:14:03

On Wed, 16 Jun 2004 12:35:41 +0200, "Cor Ligthert"




Hey,

Thank you. I was using a command object to fire off an INSERT or
UPDATE statement.

I'll change the way I update the records to StoredProcedures and try
it that way.

Thanks for the link.

Rgrds

Sarah.