SQL Statements for Command Object......

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
 
W

W.G. Ryan eMVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top