Help! Problem in executeNonQuery()

yzlin04

New member
Joined
Jul 16, 2007
Messages
3
Programming Experience
Beginner
I want to insert a new row in my MS Access table. When i try this code below, it gives me error on the -- myCommand.ExecuteNonQuery() -- row.

The error message is like this:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll




Thanks..






Dim str As String = "Provider = Microsoft.Jet.Oledb.4.0;Data source=ALK.mdb"
Dim conn As OleDbConnection = New OleDbConnection(str)

'Open Connection
conn.Open()

Dim strCommand As String = "INSERT INTO tableTempTransaction(item_Name) VALUES('" & txtItemID.Text & "')"
Dim myCommand As OleDbCommand = New OleDbCommand(strCommand, conn)

'Execute command
myCommand.ExecuteNonQuery()

'Close connection
conn.Close()

DsTempTransaction1.Clear()
OleDbDataAdapter1.Fill(DsTempTransaction1)
 
When the code stops and the small blue and grey XXXEcpetion was unhandled" window appears, Click Copy Exception Detail to the Clipboard and then paste it here
 
hello...
sorry for the late reply...i already can handle problem that i asked you. so now there is no problem anymore. thanks.

but i got another problem... i have a datagrid which displays few record....how to select a cell or all data in a row? i really don't understand about it.
 
Back
Top