ASP.NET 字符串问题

[ 1460 查看 / 2 回复 ]

String strsql = "Insert Into userinfo(userid,username,[password],province,sex,intro,register_time) values('" + Convert.ToInt32(userid.Text) + "','" + username.Text + "','" + pwd1.Text + "','" + prov.SelectedItem.Text + "','" + sex.SelectedItem.Text + "','" + intro.Text + "','" + "',#'" +"' System.DateTime.Now.ToString()'" + "#')";

字符串不对,错哪里了???

提问者: suizhikuo - 四级
TOP

String strsql = "Insert Into userinfo(userid,username,[password],province,sex,intro,register_time) values(" + userid.Text + ",'" + username.Text + "','" + pwd1.Text + "','" + prov.SelectedItem.Text + "','" + sex.SelectedItem.Text + "','" + intro.Text + "','" + "','#" + System.DateTime.Now.ToString() + "#')";



上面代码复制过去试试.
错误有2:
用户ID不需呀使用' '
日期时间你写成了 #',应该是 '#
TOP