我的程序在本地测试过没问题,担放到空间上却只能查找和更新数据,却不能插入和删除数据,何解?
以下是部分代码:
//提交数据
private void submitButton_Click(object sender, System.EventArgs e)
{
//将数据插入数据库
string insertPhotoNewsCommandString = "Insert Into LastInformation " +
"(LastInformationTitle,LastInformationContent,LastInformationSource,NewsTypeID,NewsType)" +
" Values ('" + lastInformationTitleTextBox.Text.Trim() + "','" + WebHtmlEditor1.Html.Trim() + "','" +
informationSourceTextbox.Text.Trim() + "'," + newsTypeDropDownList.SelectedItem.Value.ToString() + ",'" +
newsTypeDropDownList.SelectedItem.Text.Trim() + "')";
OleDbConnection commonOleDbConnection = new OleDbConnection(strConnectionString);
OleDbCommand insertPhotoNewsCommand = new OleDbCommand(insertPhotoNewsCommandString,commonOleDbConnection);
commonOleDbConnection.Open();
insertPhotoNewsCommand.ExecuteNonQuery();
commonOleDbConnection.Close();
Response.Write("<script>alert('数据已被成功提交!')</script>");
lastInformationTitleTextBox.Text = String.Empty;
WebHtmlEditor1.Html = String.Empty;
informationSourceTextbox.Text = String.Empty;
}
我用的是VS03+ACCESS,出错提示信息为:INSERT INTO 语句的语法错误。