|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

September 20th, 2006, 09:20 AM
|
|
Authorized User
|
|
Join Date: Aug 2006
Location: Mumbai, Maharashtra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

September 20th, 2006, 04:08 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 1 Time in 1 Post
|
|
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 "
?
|

September 21st, 2006, 01:48 AM
|
|
Authorized User
|
|
Join Date: Aug 2006
Location: Mumbai, Maharashtra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ya Its Working.Thanks.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |