问题描述
这是我sql语句stringMysql="insertintoNew
解决方案二:
(Dcid,Digid,Name,Nature,Trade,Leader,Produce,Scope,Mobile,Phone,Alltel,Fax,Email,QQ,Msn,Post,Address,Web,Country,Province,City,Area,Street,District,Tower,Floor,House,Simg,Cimg,Cimgw,Cimgh,Cimg_Big,Demo,DType,Position)values(@Dcid,@Digid,@Name,@Nature,@Trade,@Leader,@Produce,@Scope,@Mobile,@Phone,@Alltel,@Fax,@Email,@QQ,@Msn,@Post,@Address,@Web,@Country,@Province,@City,@Area,@Street,@District,@Tower,@Floor,@House,@Simg,@Cimg,@Cimgw,@Cimgh,@Cimg_Big,@Demo,@DType,@Position)";这是我的参数集合OleDbParameter[]para=newOleDbParameter[]{newOleDbParameter("@Dcid",OleDbType.VarChar,50),newOleDbParameter("@Digid",OleDbType.VarChar,20),newOleDbParameter("@Name",OleDbType.VarChar,255),newOleDbParameter("@Nature",OleDbType.Integer),newOleDbParameter("@Trade",OleDbType.Integer),newOleDbParameter("@Leader",OleDbType.VarChar,100),newOleDbParameter("@Produce",OleDbType.VarChar),newOleDbParameter("@Scope",OleDbType.VarChar),newOleDbParameter("@Mobile",OleDbType.VarChar,50),newOleDbParameter("@Phone",OleDbType.VarChar,255),newOleDbParameter("@Alltel",OleDbType.VarChar),newOleDbParameter("@Fax",OleDbType.VarChar,255),newOleDbParameter("@Email",OleDbType.VarChar,255),newOleDbParameter("@QQ",OleDbType.VarChar,50),newOleDbParameter("@Msn",OleDbType.VarChar,50),newOleDbParameter("@Post",OleDbType.VarChar,50),newOleDbParameter("@Address",OleDbType.VarChar,500),newOleDbParameter("@Web",OleDbType.VarChar,255),newOleDbParameter("@Country",OleDbType.VarChar,20),newOleDbParameter("@Province",OleDbType.VarChar,20),newOleDbParameter("@City",OleDbType.VarChar,20),newOleDbParameter("@Area",OleDbType.VarChar,20),newOleDbParameter("@Street",OleDbType.VarChar,50),newOleDbParameter("@District",OleDbType.VarChar,255),newOleDbParameter("@Tower",OleDbType.VarChar,255),newOleDbParameter("@Floor",OleDbType.VarChar,255),newOleDbParameter("@House",OleDbType.VarChar,255),newOleDbParameter("@Simg",OleDbType.VarChar,500),newOleDbParameter("@Cimg",OleDbType.VarChar,500),newOleDbParameter("@Cimgw",OleDbType.Integer),newOleDbParameter("@Cimgh",OleDbType.Integer),newOleDbParameter("@Cimg_Big",OleDbType.VarChar,500),newOleDbParameter("@Demo",OleDbType.VarChar),newOleDbParameter("@DType",OleDbType.Integer),newOleDbParameter("@Position",OleDbType.VarChar,100),}这是我的赋值语句:para[0].Value="";para[1].Value="";para[2].Value=Name1;para[3].Value=Nature1;para[4].Value=Trade1;para[5].Value=Leader1;para[6].Value=Produce1;para[7].Value=Scope1;para[8].Value=Mobile1;para[9].Value=Phone1;para[10].Value=Alltel1;para[11].Value=Fax1;para[12].Value=Email1;para[13].Value=QQ1;para[14].Value=Msn1;para[15].Value=Post1;para[16].Value=Address1;para[17].Value=Web1;para[18].Value=Country1;para[19].Value=Province1;para[20].Value=City1;para[21].Value=Area1;para[22].Value=Street1;para[23].Value=District1;para[24].Value=Tower1;para[25].Value=Floor1;para[26].Value=House1;para[27].Value=Simg1;para[28].Value=Cimg1;para[29].Value=Cimgw1;para[30].Value=Cimgh1;para[31].Value=Cimg_Big1;para[32].Value=Demo1;para[33].Value=DType1;para[32].Value=Position1;这是我的执行语句:List<OleDbParameter>paraList=newList<OleDbParameter>(para);intRof=PublicSQL.ExecParamQuery(Mysql,paraList);if(Rof==1){MessageBox.Show("单位("+Name1+")信息添加成功!","成功",MessageBoxButtons.OK,MessageBoxIcon.Information);//Linf.Text="单位("+DName1+")信息添加成功!档案号为:"+Dcid1;}else{MessageBox.Show("单位("+Name1+")信息添加失败!","失败",MessageBoxButtons.OK,MessageBoxIcon.Error);}在position之前的SQL语句我都测试过能用了能成功:stringMysql="insertintoNew
解决方案三:
(Dcid,Digid,Name,Nature,Trade,Leader,Produce,Scope,Mobile,Phone,Alltel,Fax,Email,QQ,Msn,Post,Address,Web,Country,Province,City,Area,Street,District,Tower,Floor,House,Simg,Cimg,Cimgw,Cimgh,Cimg_Big,Demo,DType)values(@Dcid,@Digid,@Name,@Nature,@Trade,@Leader,@Produce,@Scope,@Mobile,@Phone,@Alltel,@Fax,@Email,@QQ,@Msn,@Post,@Address,@Web,@Country,@Province,@City,@Area,@Street,@District,@Tower,@Floor,@House,@Simg,@Cimg,@Cimgw,@Cimgh,@Cimg_Big,@Demo,@DType)";但是加了position之后就出现错误了,提示我说是intertinto语句错误.大家绐我看看这是咋回事,我弄了一下午了,我晕死了
解决方案
解决方案四:
publicstaticintExecParamQuery(Stringsql){try{conn.Open();OleDbCommandsc=newOleDbCommand(sql,conn);returnsc.ExecuteNonQuery();}catch(Exceptionex){throw(ex);}finally{conn.Close();}}我是我执行我SQL命令的那个CS代码
解决方案五:
这是赋值那会用到的变量:protectedstringDcid1="";protectedstringDigid1="";protectedstringName1="";protectedintNature1=0;protectedintTrade1=0;protectedstringLeader1="";protectedstringProduce1="";protectedstringScope1="";protectedstringMobile1="";protectedstringPhone1="";protectedstringFax1="";protectedstringAlltel1="";protectedstringEmail1="";protectedstringQQ1="";protectedstringMsn1="";protectedstringPost1="";protectedstringAddress1="";protectedstringWeb1="";protectedstringCountry1="0";protectedstringProvince1="";protectedstringCity1="";protectedstringArea1="";protectedstringStreet1="";protectedstringDistrict1="";protectedstringTower1="";protectedstringFloor1="";protectedstringHouse1="";protectedstringSimg1="";protectedstringCimg1="";protectedintCimgw1=10;protectedintCimgh1=10;protectedstringCimg_Big1="";protectedstringDemo1="";protectedintDType1=0;protectedstringPosition1="";protectedstringTraffic1="";//数字商户变量protectedstringa;protectedintYorndisplay1=0;protectedintDigstreet1=0;protectedintDorient1=0;protectedintDrank1=0;protectedstringInputor1="";protectedDateTimeInputTime1=DateTime.Now;
解决方案六:
这个是我的Position的结构:Position文本
解决方案七:
顶下...学习咯..
解决方案八:
刚才我同事试过了,这个表还有几个参数是在positon之后的://newOleDbParameter("@Traffic",OleDbType.VarChar,100),//newOleDbParameter("@Yorndisplay",OleDbType.Integer),//newOleDbParameter("@Digstreet",OleDbType.Integer),//newOleDbParameter("@Dorient",OleDbType.Integer),//newOleDbParameter("@Drank",OleDbType.Integer),//newOleDbParameter("@Inputor",OleDbType.VarChar,50),//newOleDbParameter("@InputTime",OleDbType.Date),它们都能行,就是那个Position不行你说它是不是ACCESS的关键字呀
解决方案九:
这个以前是个SQL版本的,那时候我测了没问题后来改成ACCESS就出现在这个问题了
解决方案十:
刚才改了个名字就能行了,大家绐说说这个咋回事SQL2005问题,但是ACCESS就出现问题了