Help with MS Access Please

liunx

Guest
I'm having strange problem, when i try to read from Access it works so normal, but when i try to add any values it gives me this error:
Operation must use an updateable query.
I'm using ExecuteNonQuery1) have you double check the update query?
2) cmd.ExecuteNonQuery(); method returns the number of rows that were affected.
i.e: int updated = cmd.ExecuteNonQuery();
3) con.Open() and cmd.ExecuteNonQuery(); inside TCF ?Well i'm not sure of what you mean, but nothing is added to the database.
And here's a simplist query i use to make change in the database

Dim UpdateSql As String = "UPDATE Threads SET Views = (Views + 1) WHERE ThreadID = " & ThreadID & ""
Dim UpdateCmd As New OleDbCommand(UpdateSql, Conn)
Conn.Open()
UpdateCmd.ExecuteNonQuery()
Conn.Close()try this see if it works (sorry mix c# code with vb, but u'll get the idea):

Dim UpdateSql As String = "UPDATE Threads SET Views = (Views + 1) WHERE ThreadID = " & ThreadID & ""
Dim UpdateCmd As New OleDbCommand(UpdateSql, Conn)
try{
Conn.Open()
int updated =UpdateCmd.ExecuteNonQuery()
}
catch(Exception err){
//put msg here and say why its not working i.e: lblStatue.Text = err.Message;
}
Finally{

Conn.Close()

}well i can do this without convert to c# and it shows the same error1) hard code that UpdateSql and run it at query analyzer, see if it works...
2) it may sounds dumb, but did u import the correct namespace?
 
Back
Top