error while submitting update query

Posted by Jammyhunt under ASP.NET on 3/18/2013 | Points: 10 | Views : 752 | Status : [Member] | Replies : 0
greets all..

i have a table like this.

http://i48.tinypic.com/vdd1qa.png

and i want to show its footer value to a new table

which is like this

sl.no Total mat_total sci_total com_total

1 total1 700 1000 1050

and i used this source

OleDbConnection con;
OleDbCommand com;
string str;
protected void Page_Load(object sender, EventArgs e)
{
string connstr = "provider=microsoft.ace.oledb.12.0;data source=c:\\users\\jammy\\documents\\visual studio 2010\\websites\\testing\\app_data\\test.accdb;persist security info=true";
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = connstr;

OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.UpdateCommand = new OleDbCommand();

adapter.UpdateCommand.CommandText = "UPDATE table2 SET mat_total= SUM(maths) FROM Table1 WHERE ID=1";
conn.Open();
adapter.UpdateCommand.Connection = conn;
adapter.UpdateCommand.ExecuteNonQuery();

}


But the error i am facing is

Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query




Responses

(No response found.)

Login to post response