Hi..
i'm new in vb.net and i have problem with my project. can anyone help me with this problem..
-update button
Dim con As New OleDb.OleDbConnection(My.Settings.TREViS_03_ConnectionString)
Dim com As New OleDb.OleDbCommand
Dim adap As New OleDb.OleDbDataAdapter
Dim ds As New DataSet
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Yaya\Desktop\TREViS(03).mdb;Persist Security Info=True")
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand("update STUDENT set [Student Name]=@sName where [Student HP_No]=@sHPNo and [Student Email]=@sEmail", con)
'" & txtName.Text & "',Student HP No='" & mtxPhoneNo.Text & "',Student Email='" & txtEmail.Text & "' Where Student ID ='" & txtID.Text & "'", con)
cmd.Parameters.AddWithValue("@sName", txtName.Text)
cmd.Parameters.AddWithValue("@sHPNo", mtxPhoneNo.Text)
cmd.Parameters.AddWithValue("@sEmail", txtEmail.Text)
com.Connection = con
com.ExecuteNonQuery()
adap = New OleDbDataAdapter("select * from STUDENT", con)
adap.Fill(ds, "1")
STUDENTDataGridView.DataSource = ds.Tables("1")
error = Command text was not set for the command object. ( at com.ExecuteNonQuery() )
-delete button
Dim con As New OleDb.OleDbConnection(My.Settings.TREViS_03_ConnectionString)
Dim com As New OleDb.OleDbCommand
Dim adap As New OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim str As String
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Yaya\Desktop\TREViS(03).mdb;Persist Security Info=True")
con.Open()
str = "delete from STAFF where Staff ID like '" & txtKeyword.Text & "%'"
com.CommandText = str
com.Connection = con
com.ExecuteNonQuery()
adap = New OleDbDataAdapter("select * from STAFF", con)
adap.Fill(ds, "1")
STUDENTDataGridView.DataSource = ds.Tables("1")
error = Syntax error (missing operator) in query expression 'Staff ID like '%''. ( at com.ExecuteNonQuery() )
anyone can help me?