creating a table ado.net

  • Thread starter Thread starter PC
  • Start date Start date
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
 
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
 
Back
Top