none
未将对象引用至实例化 RRS feed

  • 问题

  • try
                {
                    _reworkNumOpreate.Open();
                    string sqltext2 = "select rn_numer from reworkNum where rn_Name = '" + reNumEntiInfo.Rn_Name + "' and rn_Model = '" + reNumEntiInfo.Rn_Model + "' and rn_Matril = '" + reNumEntiInfo.Rn_Matril + "' and rn_Process = '" + reNumEntiInfo.Rn_Process + "'";
                    object obj = _reworkNumOpreate.RunCommandEx(sqltext2);
                    if (obj == null)
                    {
                        MessageBox.Show("当前产品已空,此次为第一次录入!");
                        int countt = 0;
                        string sqlText = "insert into reworkNum(rn_Name,rn_Model,rn_Matril,rn_Process,rn_numer) values('" + reNumEntiInfo.Rn_Name + "','" + reNumEntiInfo.Rn_Model + "','" + reNumEntiInfo.Rn_Matril + "','" + reNumEntiInfo.Rn_Process + "'," + reNumEntiInfo.Rn_numer + ")";
                        _reworkNumOpreate.RunCommand(sqlText, out countt);
                        _reworkNumOpreate.CommitTrans();//提交事务

                    }
                    else
                    {
                        int count2 = int.Parse(obj.ToString());
                        int countt = 0;
                        string sqlText = "update reworkNum set rn_numer = " + count2 + "+" + reNumEntiInfo.Rn_numer + " where rn_Name = '" + reNumEntiInfo.Rn_Name + "' and rn_Model = '" + reNumEntiInfo.Rn_Model + "' and rn_Matril = '" + reNumEntiInfo.Rn_Matril + "' and rn_Process = '" + reNumEntiInfo.Rn_Process + "'";
                        _reworkNumOpreate.RunCommand(sqlText, out countt);
                        _reworkNumOpreate.CommitTrans();//提交事务
                    }
                }
                catch (SqlException ex)
                {
                    _reworkNumOpreate.RollbackTrans();//回滚事务
                }
                _reworkNumOpreate.Close();

     

    每次一提交事务 马上就报错! 真没找到问题啊!请高手赐教

    2010年10月13日 2:22

答案

全部回复