问题我无法弄清楚,为什么下面的更新查询不执行,有什么建议:与更新查询
static public void updateSelectedMainNewsImage(int newsID, string filename, string replace)
{
SqlConnection conn = new SqlConnection(ConnectionString);
conn.Open();
SqlCommand updateNews = new SqlCommand("Update newsImages SET [newsImage] [email protected] where [newsID] [email protected] AND [newsImage] [email protected]", conn);
updateNews.Parameters.AddWithValue("@newsID",SqlDbType.Int).Value = newsID;
updateNews.Parameters.AddWithValue("@filename",SqlDbType.VarChar).Value = filename;
updateNews.Parameters.AddWithValue("@replace",SqlDbType.VarChar).Value = replace;
updateNews.ExecuteNonQuery();
conn.Close();
}
数据库表模式是什么样的?另外,你是否收到错误信息? – Rob 2011-05-19 16:32:35
不,我没有得到错误,但它没有更新数据库 – 2011-05-19 16:35:26
没有症状,很难说,但我猜测值newsID和replace不匹配任何现有的行。 – 2011-05-19 16:36:06