Hello,
I write a update code but ut not work. this is the code:
'create connection
Dim Conn As
New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" + Server.MapPath("../048217248/site.mdb"))
'create DataSet and OleDbDataAdapter
Dim ds As
New DataSet("MyDataSet")
Dim objCmd
As New OleDbDataAdapter("SELECT * FROM " & _
"games WHERE ID = 164", Conn)
'fill DataSet
objCmd.Fill(ds,
"games")
'change some data
'ds.Tables("games").Rows(1)(2) = "work"
'provide SQL command and active connection
objCmd.UpdateCommand =
New OleDbCommand
objCmd.UpdateCommand.CommandText =
"UPDATE games " & _
"SET name='good' WHERE ID=164"
objCmd.UpdateCommand.Connection = Conn
'provide another SQL command and active connection
nimrod95
Member
210 Points
43 Posts
Error on update
Jun 23, 2006 12:02 PM|LINK
Hello,
I write a update code but ut not work. this is the code:
'create connection Dim Conn As New OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" + Server.MapPath("../048217248/site.mdb")) 'create DataSet and OleDbDataAdapter Dim ds As New DataSet("MyDataSet") Dim objCmd As New OleDbDataAdapter("SELECT * FROM " & _ "games WHERE ID = 164", Conn) 'fill DataSetobjCmd.Fill(ds,
"games") 'change some data 'ds.Tables("games").Rows(1)(2) = "work"
'provide SQL command and active connectionobjCmd.UpdateCommand =
New OleDbCommandobjCmd.UpdateCommand.CommandText =
"UPDATE games " & _ "SET name='good' WHERE ID=164"objCmd.UpdateCommand.Connection = Conn
'provide another SQL command and active connectionobjCmd.InsertCommand =
New OleDbCommandobjCmd.InsertCommand.CommandText =
"INSERT INTO " & _ "games (Name) VALUES ('sdg')"objCmd.InsertCommand.Connection = Conn
objCmd.Update(ds,
"games")How i can write it's good?