I have a access database setup which i am connecting to via ODBC, the access files already has all the required queries built and i would simple like to call them from within my application.
I am using Visual Basic .NET and this is what i have tried so far.....
Thanks in advance for any help you can offer.
Ben
Dim command As OdbcCommand = New OdbcCommand
command.Connection = cnx
command.CommandText = "sp_InsertClient"
command.CommandType = CommandType.StoredProcedure
'//====== create ABN paramenter =============
Dim param1 As OdbcParameter = New OdbcParameter("inABN", abn)
param1.Direction = ParameterDirection.Input
param1.DbType = DbType.String
'add abn parameter
command.Parameters.Add(param1)
Dim dataAdapter As OdbcDataAdapter = New OdbcDataAdapter(command)
dataAdapter.InsertCommand = command
Try
cnx.Open()
dataAdapter.InsertCommand.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
Finally
cnx.Close()
End Try
MessageBox.Show("DONE")