Hi, I had syntax error in the update command. I wrote this:
Dim strConn AsString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("movie.mdb")
Dim strSQL AsString = "UPDATE movieDet SET Title = '" + tb_title.Text + "', price = '" + tb_np.Text + "', des = '" + tb_desc.Text + "', Year = '" + tb_yr.Text + "', actor1 = '" + tb_ac1.Text + "' ,actor2 = '" + tb_ac2.Text + "',actor3 = '" + tb_ac3.Text + "', actor4 = '" + tb_ac4.Text + "', branch = '" + ddl_bra.SelectedValue + "',section = '" + ddl_sec.SelectedValue + "',category = '" + ddl_cat.SelectedValue + "', type = '" + ddl_type.SelectedValue + "', pic = '" + Image1.ImageUrl + "' Where MovieID = '" + tb_id.Text + "' "
Dim scnnNW AsNew OleDbConnection(strConn)
Dim scmd AsNew OleDbCommand(strSQL, scnnNW)
Dim dr As OleDbDataReader
Try
scnnNW.Open()
dr = scmd.ExecuteReader()
dr.Close()
Response.Write("Product successfully saved to the database.")
Catch exp As Exception
Response.Write("Error: " & exp.Message)
Finally
scnnNW.Close()
EndTry
I had check several times for the data type, the syntax but it seems like fine. Can anyone help?
thnkx
Dim strConn AsString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("movie.mdb")
Dim strSQL AsString = "UPDATE movieDet SET Title = '" + tb_title.Text + "', price = '" + tb_np.Text + "', des = '" + tb_desc.Text + "', Year = '" + tb_yr.Text + "', actor1 = '" + tb_ac1.Text + "' ,actor2 = '" + tb_ac2.Text + "',actor3 = '" + tb_ac3.Text + "', actor4 = '" + tb_ac4.Text + "', branch = '" + ddl_bra.SelectedValue + "',section = '" + ddl_sec.SelectedValue + "',category = '" + ddl_cat.SelectedValue + "', type = '" + ddl_type.SelectedValue + "', pic = '" + Image1.ImageUrl + "' Where MovieID = '" + tb_id.Text + "' "
Dim scnnNW AsNew OleDbConnection(strConn)
Dim scmd AsNew OleDbCommand(strSQL, scnnNW)
Dim dr As OleDbDataReader
Try
scnnNW.Open()
dr = scmd.ExecuteReader()
dr.Close()
Response.Write("Product successfully saved to the database.")
Catch exp As Exception
Response.Write("Error: " & exp.Message)
Finally
scnnNW.Close()
EndTry
I had check several times for the data type, the syntax but it seems like fine. Can anyone help?
thnkx