Hi,
all i am new to this site
please help for code given below
when i executed it not updating
it is giving error
please help
Thanks in Advance


Private Sub UpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
Try
Dim com As New OleDbCommand
com.Connection = con
com.CommandText = " update Details Set CUSTOMERNAME= '" & TextBoxcname.Text & "',CUSTOMERNO= '" & TextBoxcno.Text & "',TYPEOFORDER= '" & TextBoxtypordr.Text & "',OPTION= '" & TextBoxoption.Text & "',GIVENSAMPLE= '" & TextBoxgivensample.Text & "',DATEOFORDER= '" & TextBoxdateordr.Text & "',DATEOFDELIVERY= '" & TextBoxdatedely.Text & "',TOTALAMOUNT='" & TextBoxtotalamt.Text & "',ADVANCEAMOUNT='" & TextBoxadvamt.Text & "',BALANCEAMOUNT='" & TextBoxbalamt.Text & "',TOP_TL='" & TextBoxtoptl.Text & "',TOP_HEM='" & TextBoxtophem.Text & "',TOP_SLIT='" & TextBoxtopslit.Text & "',TOP_HIP='" & TextBoxtophip.Text & "',TOP_WST='" & TextBoxtopwst.Text & "',TOP_CHST='" & TextBoxtopchst.Text & "',TOP_SH='" & TextBoxtopsh.Text & "',TOP_SL='" & TextBoxtopsl.Text & "',TOP_AH='" & TextBoxtopah.Text & "',TOP_NECK NO='" & TextBoxtopneckno.Text & "',TOP_NECK A='" & TextBoxtopnecka.Text & "',TOP_NECK B='" & TextBoxtopneckb.Text & "',BOTTOM_TL='" & TextBoxbottomtl.Text & "',BOTTOM_HEM='" & TextBoxbottomhem.Text & "',BOTTOM_CAL='" & TextBoxbottomcal.Text & "',BOTTOM_KNEE='" & TextBoxbottomknee.Text & "',BOTTOM_THI='" & TextBoxbottomthi.Text & "',BOTTOM_HIP='" & TextBoxbottomhip.Text & "',BOTTOM_WST='" & TextBoxbottomwst.Text & "',BOTTOM_CRO='" & TextBoxbottomcro.Text & "',BOTTOM_SLIT='" & TextBoxbottomslit.Text & "',ZIP = '" & TextBoxbottomzip.Text & "' where INVOICENO=" & TextBoxinvcno.Text & ""
com.ExecuteNonQuery()
MsgBox("Record Updated")
Call Md_Settings()
Call Md_ClearAll()
Catch
MsgBox("Error")
End Try
End Sub

Recommended Answers

All 3 Replies

Welcome navachaitanya.

Read How to post?.

Your code should be surrounded by BB Code Tags.

Private Sub UpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
        Try
            Dim com As New OleDbCommand
            com.Connection = con
            com.CommandText = "Update Details Set CUSTOMERNAME= '" & TextBoxcname.Text & "',CUSTOMERNO= '" & TextBoxcno.Text & "',TYPEOFORDER= '" & TextBoxtypordr.Text & "',OPTION= '" & TextBoxoption.Text & "',GIVENSAMPLE='" & TextBoxgivensample.Text & "',DATEOFORDER= '" & TextBoxdateordr.Text & "',DATEOFDELIVERY= '" & TextBoxdatedely.Text & "',TOTALAMOUNT='" & TextBoxtotalamt.Text & "',ADVANCEAMOUNT='" & TextBoxadvamt.Text & "',BALANCEAMOUNT='" & TextBoxbalamt.Text & "',TOP_TL='" & TextBoxtoptl.Text & "',TOP_HEM='" & TextBoxtophem.Text & "',TOP_SLIT='" & TextBoxtopslit.Text & "',TOP_HIP='" & TextBoxtophip.Text & "',TOP_WST='" & TextBoxtopwst.Text & "',TOP_CHST='" & TextBoxtopchst.Text & "',TOP_SH='" & TextBoxtopsh.Text & "',TOP_SL='" & TextBoxtopsl.Text & "',TOP_AH='" & TextBoxtopah.Text & "',TOP_NECK NO='" & TextBoxtopneckno.Text & "',TOP_NECK A='" & TextBoxtopnecka.Text & "',TOP_NECK B='" & TextBoxtopneckb.Text & "',BOTTOM_TL='" & TextBoxbottomtl.Text & "',BOTTOM_HEM='" & TextBoxbottomhem.Text & "',BOTTOM_CAL='" & TextBoxbottomcal.Text & "',BOTTOM_KNEE='" & TextBoxbottomknee.Text & "',BOTTOM_THI='" & TextBoxbottomthi.Text & "',BOTTOM_HIP='" & TextBoxbottomhip.Text & "',BOTTOM_WST='" & TextBoxbottomwst.Text & "',BOTTOM_CRO='" & TextBoxbottomcro.Text & "',BOTTOM_SLIT='" & TextBoxbottomslit.Text & "',ZIP = '" & TextBoxbottomzip.Text & "' where INVOICENO='" & TextBoxinvcno.Text & "'"
            con.Open()  
            com.ExecuteNonQuery()
            con.Close()
            MsgBox("Record Updated")
            Call Md_Settings()
            Call Md_ClearAll()
        Catch
            MsgBox("Error")
        End Try
    End Sub

You should start to learn about Parameterized or Pre-compiled sql statement (Stored procedures etc) in VB.NET.

Please any one can correct it and give it to me
Thanks in advance

Private Sub UpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
        Try
            Dim com As New OleDbCommand
            com.Connection = con
            com.CommandText = "Update Details Set CUSTOMERNAME= '" & TextBoxcname.Text & "',CUSTOMERNO= '" & TextBoxcno.Text & "',TYPEOFORDER= '" & TextBoxtypordr.Text & "',OPTION= '" & TextBoxoption.Text & "',GIVENSAMPLE='" & TextBoxgivensample.Text & "',DATEOFORDER= '" & TextBoxdateordr.Text & "',DATEOFDELIVERY= '" & TextBoxdatedely.Text & "',TOTALAMOUNT='" & TextBoxtotalamt.Text & "',ADVANCEAMOUNT='" & TextBoxadvamt.Text & "',BALANCEAMOUNT='" & TextBoxbalamt.Text & "',TOP_TL='" & TextBoxtoptl.Text & "',TOP_HEM='" & TextBoxtophem.Text & "',TOP_SLIT='" & TextBoxtopslit.Text & "',TOP_HIP='" & TextBoxtophip.Text & "',TOP_WST='" & TextBoxtopwst.Text & "',TOP_CHST='" & TextBoxtopchst.Text & "',TOP_SH='" & TextBoxtopsh.Text & "',TOP_SL='" & TextBoxtopsl.Text & "',TOP_AH='" & TextBoxtopah.Text & "',TOP_NECK NO='" & TextBoxtopneckno.Text & "',TOP_NECK A='" & TextBoxtopnecka.Text & "',TOP_NECK B='" & TextBoxtopneckb.Text & "',BOTTOM_TL='" & TextBoxbottomtl.Text & "',BOTTOM_HEM='" & TextBoxbottomhem.Text & "',BOTTOM_CAL='" & TextBoxbottomcal.Text & "',BOTTOM_KNEE='" & TextBoxbottomknee.Text & "',BOTTOM_THI='" & TextBoxbottomthi.Text & "',BOTTOM_HIP='" & TextBoxbottomhip.Text & "',BOTTOM_WST='" & TextBoxbottomwst.Text & "',BOTTOM_CRO='" & TextBoxbottomcro.Text & "',BOTTOM_SLIT='" & TextBoxbottomslit.Text & "',ZIP = '" & TextBoxbottomzip.Text & "' where INVOICENO='" & TextBoxinvcno.Text & "'"
            con.Open()  
            com.ExecuteNonQuery()
            con.Close()
            MsgBox("Record Updated")
            Call Md_Settings()
            Call Md_ClearAll()
        Catch
            MsgBox("Error")
        End Try
    End Sub

hai,
I have some ideas to solve your problem.The invoiceno field of your database is of integer type.To insert integer values the syntax is
INVOICENO=" & CInt(TectBoxinvcno.Text) & "
Try this out.I am not sure this is right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.