string ConnectionString = WebConfigurationManager.ConnectionStrings["dbnameConnectionString"].ConnectionString;
SqlConnection myConnection = new SqlConnection(ConnectionString);
myConnection.Open();
try
{
string qry = "UPDATE customers SET [email protected] WHERE cid=1";
SqlCommand insertQuery = new SqlCommand(qry, myConnection);
insertQuery.Parameters.Add(new SqlParameter("@firstname", txtFirstname.Text));
insertQuery.ExecuteNonQuery();
myConnection.Close();
}
catch (Exception ee)
{
}
有什麼建議嗎?asp.net無法更新數據庫
您是否獲得一個例外? – 2010-03-31 21:13:02
否.............. – tom 2010-03-31 21:19:46
所以你的db中沒有cid = 1? – 2010-03-31 21:21:28