急急急!VS2008,asp.net(C#),关键字 'Order' 附近有语法错误。 怎么解决?
protectedvoidButton3_Click(objectsender,EventArgse){stringshipping_name=TextBox1.Text...
protected void Button3_Click(object sender, EventArgs e)
{
string shipping_name = TextBox1.Text;
string shipping_phone = TextBox2.Text;
string shipping_city = TextBox3.Text;
string shipping_add = TextBox4.Text;
using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["db_database02ConnectionString2"].ConnectionString))
{
connection.Open();
SqlCommand command = new SqlCommand("Insert Into Order(shipping_name,shipping_phone,shipping_city,shipping_add) values(@shipping_name,@shipping_phone,@shipping_city,@shipping_add)", connection);
command.CommandType = CommandType.Text;
command.Parameters.Add("@shipping_name", SqlDbType.VarChar, 50).Value = shipping_name;
command.Parameters.Add("@shipping_phone", SqlDbType.VarChar, 50).Value = shipping_phone;
command.Parameters.Add("@shipping_city", SqlDbType.VarChar, 50).Value = shipping_city;
command.Parameters.Add("@shipping_add", SqlDbType.VarChar, 50).Value = shipping_add;
command.ExecuteNonQuery();
Page.RegisterStartupScript("", "<script language=javascript> parent.window.alert('订单提交成功!');</script>");
}
}
这是“提交订单”button的语句
数据库中OrderID设置的主键,并表示增量设置成1 展开
{
string shipping_name = TextBox1.Text;
string shipping_phone = TextBox2.Text;
string shipping_city = TextBox3.Text;
string shipping_add = TextBox4.Text;
using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["db_database02ConnectionString2"].ConnectionString))
{
connection.Open();
SqlCommand command = new SqlCommand("Insert Into Order(shipping_name,shipping_phone,shipping_city,shipping_add) values(@shipping_name,@shipping_phone,@shipping_city,@shipping_add)", connection);
command.CommandType = CommandType.Text;
command.Parameters.Add("@shipping_name", SqlDbType.VarChar, 50).Value = shipping_name;
command.Parameters.Add("@shipping_phone", SqlDbType.VarChar, 50).Value = shipping_phone;
command.Parameters.Add("@shipping_city", SqlDbType.VarChar, 50).Value = shipping_city;
command.Parameters.Add("@shipping_add", SqlDbType.VarChar, 50).Value = shipping_add;
command.ExecuteNonQuery();
Page.RegisterStartupScript("", "<script language=javascript> parent.window.alert('订单提交成功!');</script>");
}
}
这是“提交订单”button的语句
数据库中OrderID设置的主键,并表示增量设置成1 展开
3个回答
展开全部
order是关键字,你用[]方括号,给括下,去试下!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Insert Into Order(shipping_name,shipping_phone,shipping_city,shipping_add) values(@shipping_name,@shipping_phone,@shipping_city,@shipping_add)
order是关键字
Insert Into [Order] (shipping_name,shipping_phone,shipping_city,shipping_add) values(@shipping_name,@shipping_phone,@shipping_city,@shipping_add)
order是关键字
Insert Into [Order] (shipping_name,shipping_phone,shipping_city,shipping_add) values(@shipping_name,@shipping_phone,@shipping_city,@shipping_add)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询