')' 附近有语法错误。
protectedvoidButton1_Click(objectsender,EventArgse){string_title=tbTitle.Text;string_...
protected void Button1_Click(object sender, EventArgs e)
{
string _title = tbTitle.Text;
string _brief = tbBrief.Text;
string _authors = tbAuthors.Text;
string _source = tbSource.Text;
string _content = tbContents.Text;
string strSql = string.Format("insert into news(title,parentid,brief,citme,authors,source,contents,) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", _title, 1, _brief, DateTime.Now, _authors, _source, _content);
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=class1;Persist Security Info=True;User ID=sa;Password=P@ssw0rd");
conn.Open();
SqlCommand cmd = new SqlCommand(strSql, conn);
int i = cmd.ExecuteNonQuery();
conn.Close();
}
}
int i = cmd.ExecuteNonQuery();
错误标出是这一行')' 附近有语法错误。 展开
{
string _title = tbTitle.Text;
string _brief = tbBrief.Text;
string _authors = tbAuthors.Text;
string _source = tbSource.Text;
string _content = tbContents.Text;
string strSql = string.Format("insert into news(title,parentid,brief,citme,authors,source,contents,) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", _title, 1, _brief, DateTime.Now, _authors, _source, _content);
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=class1;Persist Security Info=True;User ID=sa;Password=P@ssw0rd");
conn.Open();
SqlCommand cmd = new SqlCommand(strSql, conn);
int i = cmd.ExecuteNonQuery();
conn.Close();
}
}
int i = cmd.ExecuteNonQuery();
错误标出是这一行')' 附近有语法错误。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询