Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 20th, 2006, 08:20 AM
Authorized User
 
Join Date: Aug 2006
Location: Mumbai, Maharashtra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to amit_mande@yahoo.com Send a message via AIM to amit_mande@yahoo.com Send a message via MSN to amit_mande@yahoo.com Send a message via Yahoo to amit_mande@yahoo.com
Default I solved insert query.now see this Update Query.

see this code

 Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
        Dim intPosition As Int16
        myCommand = New OleDbCommand
        intPosition = myCurrencyManager.Position
        myCommand.CommandText = "UPDATE login SET Password=@Password WHERE UserId=@UserId"
        myCommand.Parameters.Add("@UserId", BindingContext(myDataView).Current("UserId"))
        myCommand.Parameters.Add("@Password", txtPassword.Text)
        myCommand.CommandType = CommandType.Text
        myCommand.Connection = myConnection

        myConnection.Open()
        Try
            myCommand.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
        FillDataSetAndView()
        BindFields()

        myCurrencyManager.Position = intPosition
        ShowPosition()

        StatusBar1.Text = "Record Updated"
        myConnection.Close()
    End Sub

The error is "Syntax error in UPDATE Query" Its is catch by try...catch statement
which is correct form of Query?

Reply With Quote
  #2 (permalink)  
Old September 20th, 2006, 03:08 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

In my opinion, it would have been good if this had been continued in the thread where it was begun; that would have made it so that your statements had a context. Saying in this thread that you fixed something means nothing to those who don't know what you fixed...
For those coming to this new, the original is in http://p2p.wrox.com/topic.asp?TOPIC_ID=49965

____________________ _
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯


Perhaps your query is trying to translate the field name as a keyword.

What happens if you use
Code:
Private Sub cmdUpdate_Click(ByVal sdr As System.Object, _
                            ByVal e As System.EventArgs) _
            Handles cmdUpdate.Click

        Dim intPosition As Int16
        intPosition = myCurrencyManager.Position

        myCommand = New OleDbCommand
        myCommand.CommandText = "UPDATE login                      " & _
                                "SET    login.Password = @Password " & _
                                "WHERE  UserId         = @UserId   "
                                or
Code:
Private Sub cmdUpdate_Click(ByVal sdr As System.Object, _
Code:
                            ByVal e As System.EventArgs) _
            Handles cmdUpdate.Click

        Dim intPosition As Int16
        intPosition = myCurrencyManager.Position

        myCommand = New OleDbCommand
        myCommand.CommandText = "UPDATE login                         " & _
                                "SET   [login].[Password] = @Password " & _
                                "WHERE [login].[UserId]   = @UserId   "
                                ?
Reply With Quote
  #3 (permalink)  
Old September 21st, 2006, 12:48 AM
Authorized User
 
Join Date: Aug 2006
Location: Mumbai, Maharashtra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to amit_mande@yahoo.com Send a message via AIM to amit_mande@yahoo.com Send a message via MSN to amit_mande@yahoo.com Send a message via Yahoo to amit_mande@yahoo.com
Default

Ya Its Working.Thanks.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SOLVED...VBA and Update Query eusanpe Access VBA 8 June 2nd, 2008 08:48 AM
Insert query problem. -- Solved rupen Classic ASP Basics 5 May 15th, 2007 08:59 AM
New Insert Query Neal SQL Server 2000 3 May 8th, 2007 01:22 PM
INSERT Query Neal SQL Server 2000 2 May 3rd, 2007 05:18 PM



All times are GMT -4. The time now is 05:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.