插不进数据...求助
点击button后,出错 找不到输出表 'ads' ,ads为数据库
protected void Button2_Click(object sender, EventArgs e)
{
String connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:Web/App_Data/ads.mdb";
OleDbConnection connection = new OleDbConnection(connectionString);
string notice_TitleStr = "noticeTitle";
string notice_TimeStr = "noticeTime";
string notice_ContentStr = "noticeContent";
string sqlString = "insert into ads([notice_Title],[notice_Time],[notice_Content]) values('" + notice_TitleStr + "','" + notice_TimeStr + "','" + notice_ContentStr + "')";
connection.Open();
OleDbCommand cmd = new OleDbCommand(sqlString,connection);
cmd.ExecuteNonQuery();
}
------解决方案--------------------
string sqlString = "insert into ads([notice_Title],[notice_Time],[notice_Content]) values('" + notice_TitleStr + "','" + notice_TimeStr + "','" + notice_ContentStr + "')";
有这个表ads不?
------解决方案--------------------
sql问题
你断点跟踪到sql这一行
看看这行会是什么
很明显你连表和库每分清楚
------解决方案--------------------
ads是数据库吧,不是里面表的名称吧?确定该库中是否包含该表ads
------解决方案--------------------
楼主你得分清表和库喔。