VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Urgent Update statement Posted by manutd4life on 22 Jun 2009 at 12:18 PM
Hello every1 i got a problem to wirte my update statement.
Here's the code:
Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click

        Dim com As New OleDbCommand
        com.Connection = con
        com.CommandText = "update Watches set WatchBrand='" & txtWatchBrand.Text & "',WatchModel='" & txtWatchModel.Text & _
                                "',Manufacturer='" & txtManufacturer.Text & "',CountryOfOrigin='" & txtCountryOfOrigin.Text & "',Type='" & _
                                cmbType.Text & "',DescriptionOfWatch='" & txtDescription.Text & _
                                ",Price=" & txtPrice.Text & ",PriceInclVat=" & txtPriceInclVat.Text & " Where WatchID='" & cmbWatchId.Text
        com.ExecuteNonQuery()
        MsgBox("Record Updated")
        Call populate()

    End Sub


Please help as soon as possible, it very important, please help
Report
Re: Urgent Update statement Posted by seancampbell on 24 Jun 2009 at 8:42 AM
rivate Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click

        Dim com As New OleDbCommand
        com.Connection = con
        com.CommandText = "update Watches set WatchBrand='" & txtWatchBrand.Text & "',WatchModel='" & txtWatchModel.Text & _
                                "',Manufacturer='" & txtManufacturer.Text & "',CountryOfOrigin='" & txtCountryOfOrigin.Text & "',Type='" & _
                                cmbType.Text & "',DescriptionOfWatch='" & txtDescription.Text & _
                                ",Price=" & txtPrice.Text & ",PriceInclVat=" & txtPriceInclVat.Text & " Where WatchID='" & cmbWatchId.Text & "'"
        com.ExecuteNonQuery()
        MsgBox("Record Updated")
        Call populate()

    End Sub


Added - & "'" - to the end of your Update line. that is most likely the issue you were having. You openned the string quote, but didn't close it...

Let me know if that works,
Sean C



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.