prav_roy
Well-known member
Operation must use Updateable Query Error
i have the following code which works fine in my PC but the same code when i run it in office it doesn't work, i have to show one demo tommarrow plzzzzzzzzzz help me no..
/*********my code********/
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DS AsNew DataSet()
Dim a AsString
a = "hello"
Dim DA As OleDbDataAdapter = New OleDbDataAdapter()
Dim com As OleDbCommand = New OleDbCommand("select * from addi", dbconn)
com.CommandType = CommandType.Text
DA.SelectCommand = com
DA.TableMappings.Add("Tables", "addi")
Try
DS.Clear()
dbconn.Open()
DA.Fill(DS, "addi")
Dim DT As DataTable = DS.Tables("addi")
Dim DR As DataRow = DT.NewRow()
DR("idi") = TextBox1.Text
DR("name") = TextBox2.Text
DR("age") = TextBox3.Text
DT.Rows.Add(DR)
Dim incom As OleDbCommand = New OleDbCommand(" INSERT INTO addi(idi,name,age)values(?,?,?)", dbconn)
incom.Parameters.Add("idi", OleDbType.VarChar, 0, "idi")
incom.Parameters.Add("name", OleDbType.VarChar, 0, "name")
incom.Parameters.Add("age", OleDbType.VarChar, 0, "age")
DA.InsertCommand = incom
DA.Update(DS, "addi")
Finally
dbconn.Close()
EndTry
EndSub
/*******************************/
error i get is
******************
Operation must use an updateable query.
i have the following code which works fine in my PC but the same code when i run it in office it doesn't work, i have to show one demo tommarrow plzzzzzzzzzz help me no..
/*********my code********/
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DS AsNew DataSet()
Dim a AsString
a = "hello"
Dim DA As OleDbDataAdapter = New OleDbDataAdapter()
Dim com As OleDbCommand = New OleDbCommand("select * from addi", dbconn)
com.CommandType = CommandType.Text
DA.SelectCommand = com
DA.TableMappings.Add("Tables", "addi")
Try
DS.Clear()
dbconn.Open()
DA.Fill(DS, "addi")
Dim DT As DataTable = DS.Tables("addi")
Dim DR As DataRow = DT.NewRow()
DR("idi") = TextBox1.Text
DR("name") = TextBox2.Text
DR("age") = TextBox3.Text
DT.Rows.Add(DR)
Dim incom As OleDbCommand = New OleDbCommand(" INSERT INTO addi(idi,name,age)values(?,?,?)", dbconn)
incom.Parameters.Add("idi", OleDbType.VarChar, 0, "idi")
incom.Parameters.Add("name", OleDbType.VarChar, 0, "name")
incom.Parameters.Add("age", OleDbType.VarChar, 0, "age")
DA.InsertCommand = incom
DA.Update(DS, "addi")
Finally
dbconn.Close()
EndTry
EndSub
/*******************************/
error i get is
******************
Operation must use an updateable query.
Last edited by a moderator: