Help with INSERT statement.

  • Thread starter Thread starter Eashrak
  • Start date Start date
E

Eashrak

Hi

I need to perform following querie in vb.net

The queries are;

NSERT INTO [destTbl] (field1, field2)
SELECT srcTbl.field1, srcTbl.field2
FROM srcTbl
WHERE (((srcTbl.entry_id) Not In (SELECT srcTbl.entry_id FROM [destTbl])));


In access I just run these query and job is done without any error in SQL
View. What is the easiest way to execute this querie in
ado.net/vb.net?


Thanks
 
Create a command and connection object. Set the connection's
connectionString property to the connection strnig of the db you want to
use. Set the command's CommandText property to this query below. In your
code, open the connection by calling the Connection's Open method, the call
the ExecuteNonQuery on the command, then close the connection using the
connection's close method.

Does this make sense?
 
thanks a lot
W.G. Ryan said:
Create a command and connection object. Set the connection's
connectionString property to the connection strnig of the db you want to
use. Set the command's CommandText property to this query below. In your
code, open the connection by calling the Connection's Open method, the
call the ExecuteNonQuery on the command, then close the connection using
the connection's close method.

Does this make sense?
Eashrak said:
Hi

I need to perform following querie in vb.net

The queries are;

NSERT INTO [destTbl] (field1, field2)
SELECT srcTbl.field1, srcTbl.field2
FROM srcTbl
WHERE (((srcTbl.entry_id) Not In (SELECT srcTbl.entry_id FROM
[destTbl])));


In access I just run these query and job is done without any error in SQL
View. What is the easiest way to execute this querie in
ado.net/vb.net?


Thanks
 
Back
Top