467,146 Members | 1,274 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

Updating a Access database

Hey guys,



I have tryed something new code with updating an access database but the error

Syntax error in UPDATE statement occurs every time i try to update. Can some please help me figure out why this problem is happening. Here is the code



Public Class Form1


[code]
Dim con As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OleDB.4.0;Data Source = E:\WindowsApplication1\WindowsApplication1\bin\Deb ug\rl.mdb;")



Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click



updatedata()



End Sub



Public Function updatedata()



Dim str1 As String = "UPDATE playersnames SET Player Name = '" & TextBox1.Text & "' AND Meters = '" & TextBox2.Text & "'"

Dim cmd As New OleDb.OleDbCommand(str1, con)

con.Open()

cmd.ExecuteNonQuery()

cmd.Cancel()

con.Close()

intialization()

intialization2()



End Function



Public Function intialization()



Dim adp As New OleDb.OleDbDataAdapter("select * from playermeters", con)

Dim dt As DataTable

Dim ds As New DataSet

adp.Fill(ds)

dt = ds.Tables(0)



End Function



Public Function intialization2()



Dim adp As New OleDb.OleDbDataAdapter("select * from playersmeters", con)

Dim dr As DataRow

Dim dt As DataTable

Dim ds As New DataSet

adp.Fill(ds)

dt = ds.Tables(0)



End Function

[code]
Jun 29 '07 #1
  • viewed: 985
Share:
1 Reply
kenobewan
Expert 4TB
Suggest you write the update statement and see if there is a problem.
Jun 30 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by junglist | last post: by
2 posts views Thread by Alexey.Murin@gmail.com | last post: by
5 posts views Thread by aaron.m.johnson@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.