SQL Statements for Command Object......

  • Thread starter Thread starter Benjamin
  • Start date Start date
B

Benjamin

Here is my development environment.

..Net 1.1 Framework



Is it possible to issue more than one SQL statement for a command Object.



Below is the code.



Dim cmdObject As New SqlCommand

cmdObject.Connection = AmisysCon

cmdObject.CommandType = CommandType.Text

cmdObject.CommandText = "DELETE FROM TABLE1;DELETE FROM TABLE2"

intCmdResults = cmdObject.ExecuteNonQuery()



Is it possible to issue more than one SQL statements as mentioned above? Is
there any unknown consequences?

Thanks,

Benjamin
 
As long as your database implementation (ie Oracle, Sql Server) supports it
you're good to go. If you use a DataReader, you use .Read to advance to the
next record but use the .ReadNext to advance to the next result set. If you
use that same command and fill a DataSet with it, each table will be in a
separate datatable and you can use the TableMappings collection to map
things over.

HTH,

Bill
 
Back
Top