在VC++2005中修改数据库,我的语句是:
 String^ ID=this->textBox6->Text;
String^ name=this->textBox1->Text;
String^ eprice=this->textBox2->Text;
String^ sprice=this->textBox3->Text;
String^ stor=this->textBox4->Text;
String^ merc=this->textBox5->Text;
String^ MySQL= "INSERT Articale(ID,name,enter_price,sale_price,storage,merchant) " +
                            "VALUES(ID,name,eprice,sprice,stor,merc )";
System::Data::SqlClient::SqlConnection^ MyConnection=gcnew System::Data::SqlClient::SqlConnection("Data Source = .;Database = supermarketmanager;Integrated Security=SSPI");
System::Data::SqlClient::SqlCommand^ MyCommand=gcnew System::Data::SqlClient::SqlCommand(MySQL, MyConnection);
            try
            {
                MyCommand->Connection->Open();
                MyCommand->ExecuteNonQuery();
                MessageBox::Show("成功在数据库中添加新记录", "信息提示",MessageBoxButtons::OK, MessageBoxIcon::Information);
            }
            catch(Exception^ ex)
            {
                MessageBox::Show(ex->Message, "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
            }
            finally
            {
                if(MyConnection->State == ConnectionState::Open) 
                {
                    MyConnection->Close();
                }
            }
编译的时候出现:在 System.Data.SqlClient.SqlException 中第一次偶然出现的“System.Data.dll”类型的异常
在 System.Data.SqlClient.SqlException 中第一次偶然出现的“System.Data.dll”类型的异常
”类型的异常