I have the following code:
updated
try
{
ArticleId = Request.QueryString["ArticleId"].ToString();
NewArticleTitle = Request.Form["ArticleTitle"].ToString();
NewArticleDate = Request.Form["ArticleDate"].ToString();
NewArticleBody = Request.Form["ArticleBody"].ToString();
string dpath = Server.MapPath(@"App_Data") + "/MySite.mdb";
string connectionstring = @"Data source='" + dpath + "';Provider='Microsoft.Jet.OLEDB.4.0';";
OleDbConnection con = new OleDbConnection(connectionstring);
string QuaryString = String.Format("update tblarticles set articletitle='{0}', articlebody='{1}', postdate='{2}' where articleid={3}", NewArticleTitle, NewArticleBody, NewArticleDate, ArticleId);
OleDbCommand cmd = new OleDbCommand(QuaryString, con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "tbl");
con.Close();
Response.Redirect("ArticlesTable.aspx");
}
catch { }
The ArticleId is an AUTO INCREMENT (in number type)
When it got to this line da.Fill(ds, "tbl"); the program coutinue to the catch.
My quastion is how can I prevent it so the table will be really update ?
Wish for help, thanks!
As the
ArticleIdis Numeric so you need to replace this:With this:
So your where clause should look like: