VS2005提交信息数据库读取不到~

来源:百度知道 编辑:UC知道 时间:2024/05/21 08:25:17
protected void Button1_Click(object sender, EventArgs e)
{
SqlAccess conn = null;
string strname = "";
string strnativeplace = "";
string strmaxim = "";
string straccompplished = "";
string strlike = "";
string strexperience = "";

strname = txtName.Text;
strnativeplace = txtNativeplace.Text;
strmaxim = txtMaxim.Text;
straccompplished = txtAccompplished.Text;
strlike = txtLike.Text;
strexperience = txtExperience.Text;
Constellation.SelectedValue = "";//这是下拉菜单控件,取他们的值在提交到数据库
Bloodtype.SelectedValue = "";//同上
txtType.SelectedValue = "";//同上

strname = PublicMethod.filterField(strname);
strnativeplace = PublicMethod.filterField(strnativeplace);

INSERT INTO ZY_DRILLMASTER(ID,NAME,TYPE,NATIVEPLACE,CONSTELLATION,BLOODTYPE,MAXIM,ACCOMPPLISHED,LIKE,EXPERIENCE)VALUES(" + id + ",'" + strname + "',"+txtType+",'" + strnativeplace + "',"+Constellation+","+Bloodtype+",'" + strmaxim + "','" + straccompplished +"','" + strlike + "','" + strexperience + "',)
你Sql语句有错误。。。。
VALUES左边要空格,最后的反括号内多了个逗号,还有你注意下数据库内的字段类型是否匹配(就是该加单引和不该加单引号的问题)