|
-
Mar 27th, 2004, 03:42 PM
#1
Thread Starter
Lively Member
help !!!!!!!!!!!!!!!!!!!
hi all ~~
i have one stupid Question want to ask
i have using a insert command to add the data into the Access database but i got an error
--------------------------------------------------------------
coding
--------------------------------------------------------------
Imports System.Data
Imports System.Data.OleDb
#End Region
Dim mypath = Application.StartupPath & "\RestaurantBookingDb.mdb"
Dim mypassword = ""
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mypath & ";Jet OLEDB atabase Password=" & mypassword)
Dim cmd As OleDbCommand
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
Dim strSQL As String
'Addnew
strSQL = "Insert Into CustomersBooking (cname,chp) Values (" & "'" & cname.Text & "'" & "," & "'" & chp.Text & "')"
conn.Open()
'Command Object to Execute the SQL
Dim ocmd As OleDbCommand = New OleDbCommand(strSQL, conn)
ocmd.ExecuteNonQuery()
'Cleanup
ocmd.Dispose()
conn.Close()
End Sub
End Class
---------------------------------------------
End
---------------------------------------------
is there got any error on it ???
it pointed to here --> ocmd.ExecuteNonQuery()
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|