hi
i trying to update some information with a picture to the database
but it display followin error message
"Syntax Error in Update Statement"
this is my code
plz any one can help me?
i'm a beginner learning VB.net
Try
Dim fsreader As New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
Dim breader As New BinaryReader(fsreader)
Dim imgbuffer(fsreader.Length) As Byte
breader.Read(imgbuffer, 0, fsreader.Length)
fsreader.Close()
con1.Open()
com1.CommandText = "UPDATE Employee set EId=@dtaEId,DNo=@dtaDNo,FName=@dtaFname,MName=@dtaMName,LName=@dtaLName,Address_Line1=@dtaAddress1,Address_Line2=@dtaAddress2,Address_Line3=@dtaAddress3,NIC=@dtaNIC,DOB=@dataDOB,Gender=@dtaGender,,Telephone=@datTele,E_mail=@dtaEmail,Emp_Photo=@dtaPhoto WHERE EId='" & Me.MaskedTextBox6.Text & "'"
com1.Connection = con1
com1.Parameters.AddWithValue("@dtaEId", ECODEMasked1.Text)
com1.Parameters.AddWithValue("@dtaDNo", MaskedTextBox5.Text)
com1.Parameters.AddWithValue("@dtaFname", TextBox3.Text)
com1.Parameters.AddWithValue("@dtaMName", TextBox4.Text)
com1.Parameters.AddWithValue("@dtaLName", TextBox5.Text)
com1.Parameters.AddWithValue("@dtaAddress1", TextBox6.Text)
com1.Parameters.AddWithValue("@dtaAddress2", TextBox7.Text)
com1.Parameters.AddWithValue("@dtaAddress3", TextBox8.Text)
com1.Parameters.AddWithValue("@dtaNIC", ENICMasked3.Text)
com1.Parameters.AddWithValue("@dataDOB", DateTimePicker1.Value.Date)
com1.Parameters.AddWithValue("@dtaGender", ComboBox3.SelectedItem)
com1.Parameters.AddWithValue("@datTele", ETeleMasked2.Text)
com1.Parameters.AddWithValue("@dtaEmail", TextBox10.Text)
com1.Parameters.AddWithValue("@dtaPhoto", imgbuffer)
com1.ExecuteNonQuery()
con1.Close()
com1.Dispose()
If MessageBox.Show("Are You Sure", "Upadet", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
MsgBox("Succsessfully Updated", MsgBoxStyle.Information, "Employee")
End If
Catch ex As Exception
MsgBox(ex.ToString())
End Try