Run AccessAppend Query

  • Thread starter Thread starter Yahya
  • Start date Start date
¤ Dear Sires,
¤
¤ How can I run an append query in access from vb.net?
¤

Not sure if you're referring to a QueryDef or SQL statement. The following executes a QueryDef:

Dim AccessConn As System.Data.OleDb.OleDbConnection
Dim AccessCommand As System.Data.OleDb.OleDbCommand

AccessConn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

AccessCommand = New System.Data.OleDb.OleDbCommand("QueryDefName", AccessConn)
AccessCommand.CommandType = CommandType.StoredProcedure
AccessCommand.Parameters.Add("@ParamName", System.Data.OleDb.OleDbType.VarWChar).Value =
"SomeValue"

AccessCommand.ExecuteNonQuery()

AccessConn.Close()


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top