creating a table ado.net

P

PC

how can i in ado.net (vb.net) create a new table based on an existing table
like in ado classic:
Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=....."
Cnn.Open
SQL = "SELECT * INTO Table2 FROM Table1"
Cnn.Execute SQL
 
C

Cor Ligthert

PC,

You have to create a command something as
Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=....."
Cnn.Open
SQL = "SELECT * INTO Table2 FROM Table1"

Assuming that your connectionstring is correct and that you made an
oledbconnection.

dim cmd as new oledb.oledbcommand(SQL, cnn)
cmd.executenonquery
cnn.dispose

Or better

\\\
Try
Cnn.Open
Try
dim cmd as new oledb.oledbcommand(SQL,cnn)
Catch ex as exception 'can even still better
messagebox.show(ex.toString)
End Try
Catch ex as exception
messagebox.show(ex.toString)
Finally
Cnn.Dispose
End Try
////

I hope this helps,

Cor
 

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