'13' 附近有语法错误。
一剑 2007-06-12 01:28:56 运行如下代码出现:
'13' 附近有语法错误,不知道怎么解决,请教啊
try
{
string strIP = this.Request.ServerVariables.Get("HTTP_X_FORWARDED_FOR");
if( strIP == "" )
strIP = this.Request.ServerVariables.Get("REMOTE_ADDR");
SqlConnection objConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["RmmWeb"].ConnectionString);
StringBuilder strSQL = new StringBuilder("INSERT INTO msgboard(name,email,ttext,date,ip) values('");
strSQL.Append(this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.TextBox3.Text );
strSQL.Append("'," + DateTime.Now + ",'" + strIP + "')");
SqlCommand objCommand = new SqlCommand(strSQL.ToString(), objConnection);
objConnection.Open();
objCommand.ExecuteNonQuery();
objConnection.Close();
this.Response.Redirect("Message.aspx?page=" + this.Request["page"]);
}
catch(Exception ex)
{
this.Label1.Text = ex.Message;
}