inserting onto Ms access using vb.NEt

  • Thread starter Thread starter Guest
  • Start date Start date
Add a System DSN called myAccessDb (or whatever) that points to your MsAccess
database using the ODBC Data Source Administrator.

imports System.Data.Odbc

dim connOdbc as new odbcconnection
dim cmdOdbc as new odbccommand
dim nRowsAffected as integer

connOdbc.ConnectionString = "DSN=myAccessDb;"
connOdbc.Open()
cmdOdbc.Connection = connOdbc
cmdOdbc.CommandText = "INSERT INTO tablename (col1, col2) VALUES (1, 2);"
nRowsAffected = cmdOdbc.ExecuteNonQuery()
connOdbc.Close()
 

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

Back
Top