Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
Dim mstream As New System.IO.MemoryStream()
Imgupload.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage() As Byte = mstream.GetBuffer()
mstream.Close()
sql = "UPDATE empinfo SET fname=@fname, lname=@lname, oname=@oname, address=@address, dob=@dob, age=@age, gender=@gdr, status=@status" _
& "city=@city, phone=@phone, pcode=@pcode, state=@state, lg=@lg, cname=@cname, cphone=@cphone, caddress=@caddress, sdate=@sdate, edate=@edate" _
& "img=@Imgdata, klname=@klname, kfname=@kfname, kphone=@kphone, kaddress=@kaddress, qual=@qual, expr=@expr, lyeardate=@lyeardate" _
& "pyeardate=@pyeardate, dpermitted=@dpermitted, centitle=@centitle, ctaken=@ctaken, cleft=@cleft, cadre=@cadre" _
& "WHERE id= '" & txtid.Text & "'"
Try
dbcomm = New MySqlCommand(sql, dbconn)
dbcomm.Parameters.AddWithValue("@fname", txtfname.Text)
dbcomm.Parameters.AddWithValue("@lname", txtlname.Text)
dbcomm.Parameters.AddWithValue("@oname", txtoname.Text)
dbcomm.Parameters.AddWithValue("@address", txtaddress.Text)
dbcomm.Parameters.AddWithValue("@dob", DateTimePicker1.Value)
dbcomm.Parameters.AddWithValue("@age", txtage.Text)
dbcomm.Parameters.AddWithValue("@gdr", cmbgender.Text)
dbcomm.Parameters.AddWithValue("@status", cmbstatus.Text)
dbcomm.Parameters.AddWithValue("@city", txtcity.Text)
dbcomm.Parameters.AddWithValue("@phone", txtphone.Text)
dbcomm.Parameters.AddWithValue("@pcode", txtcode.Text)
dbcomm.Parameters.AddWithValue("@state", cmbstate.Text)
dbcomm.Parameters.AddWithValue("@lg", txtlg.Text)
dbcomm.Parameters.AddWithValue("@cname", txtcname.Text)
dbcomm.Parameters.AddWithValue("@cphone", txtcphone.Text)
dbcomm.Parameters.AddWithValue("@caddress", txtcaddress.Text)
dbcomm.Parameters.AddWithValue("@sdate", cdate1.Value)
dbcomm.Parameters.AddWithValue("@edate", cdate2.Value)
dbcomm.Parameters.AddWithValue("@imgdata", arrImage)
dbcomm.Parameters.AddWithValue("@klname", txtklname.Text)
dbcomm.Parameters.AddWithValue("@kfname", txtkfname.Text)
dbcomm.Parameters.AddWithValue("@kphone", txtkphone.Text)
dbcomm.Parameters.AddWithValue("@kaddress", txtcaddress.Text)
dbcomm.Parameters.AddWithValue("@qual", txtqual.Text)
dbcomm.Parameters.AddWithValue("@expr", txtexpr.Text)
dbcomm.Parameters.AddWithValue("@lyeardate", txtlyeardate.Text)
dbcomm.Parameters.AddWithValue("@pyeardate", txtpyeardate.Text)
dbcomm.Parameters.AddWithValue("@dpermitted", txtpermitted.Text)
dbcomm.Parameters.AddWithValue("@centitle", txtcentitle.Text)
dbcomm.Parameters.AddWithValue("@ctaken", txtctaken.Text)
dbcomm.Parameters.AddWithValue("@cleft", txtcleft.Text)
dbcomm.Parameters.AddWithValue("@cadre", cmbcadre.Text)
dbread = dbcomm.ExecuteReader()
dbread.Close()
MsgBox(" Record Updated successfully")
Catch ex As Exception
MsgBox("Error is :" & ex.Message)
dbread.Close()
Exit Sub
End Try
End Sub
What I have tried:
I've tried redefined the parameter but no way. pls help me out