日期:2014-05-18  浏览次数:20481 次

mycommand.ExecuteNonQuery();语句的结束位置缺少分号!!!真奇怪!!!
明明有分号,提示缺少分号。
添加的参数可以不用看。他提示是在mycommand.ExecuteNonQuery();处缺少分号。
    string   cmd3   =   "Insert   into   KHGL_Customer(cCusCode,cCusName,cCusAbbName,iDCID,cCusAddressMX,cCusSJName)   values(@cCusCode,@cCusName,@cCusAbbName,@iDCID,@cCusAddressMX,@cCusSJName)   where   iCustomerId= "   +   Temp;
                mycommand   =   new   OleDbCommand(cmd3,   myconnection);
                mycommand.Parameters.Add(new   OleDbParameter( "@cCusCode ",   OleDbType.Char,   20));
                mycommand.Parameters.Add(new   OleDbParameter( "@cCusName ",   OleDbType.VarChar,   50));
                mycommand.Parameters.Add(new   OleDbParameter( "@cCusAbbName ",   OleDbType.VarChar,   50));
                mycommand.Parameters.Add(new   OleDbParameter( "@iDCID ",   OleDbType.Char,   20));
                mycommand.Parameters.Add(new   OleDbParameter( "@cCusAddressMX ",   OleDbType.VarChar,   100));
                mycommand.Parameters.Add(new   OleDbParameter( "@cCusSJName ",   OleDbType.VarChar,   50));

                mycommand.Parameters[ "@cCusCode "].Value   =   cCusCode_Box.Text;
                mycommand.Parameters[ "@cCusName "].Value   =   cCusName_Box.Text;
                mycommand.Parameters[ "@cCusAbbName "].Value   =   cCusAbbName_Box.Text;
                mycommand.Parameters[ "@iDCID "].Value   =   iDCID_Box.Text;
                mycommand.Parameters[ "@cCusAddressMX "].Value   =   cCusAddressMX_Box.Text;
                mycommand.Parameters[ "@cCusSJName "].Value   =   cCusSJName_Box.Text;
                myconnection.Open();
                mycommand.ExecuteNonQuery();
                //添加确认对话框
                Response.Write( " <script> window.alert( '保存成功! ') </script> ");

                myconnection.Close();

------解决方案--------------------
没理解..