PDA

View Full Version : Update کردن DB در SQL2000



ara12345
سه شنبه 23 مرداد 1386, 12:32 عصر
سلام
من موقع Connect شدن به Db در قسمت Scnn.Open()
Exeption دریافت می کنم؟

omid_Ahmadi
سه شنبه 23 مرداد 1386, 13:10 عصر
نوع Exception ای که دریافت می کنید رو باید وارد کنید. چه خطایی ایجاد میشه؟

ara12345
سه شنبه 23 مرداد 1386, 13:20 عصر
برنامه در C# است و
string strConn = "Data Source=\".\\SQLServer2000\";AttachDbFilename=\"C:\\Documents and Settings\\neda\\My Documents\\Visual Studio 2005\\Projects\\Factory.mdf\";Integrated Security=True;User Instance=True;integrated security=SSPI";

---------------------------------------------------------------------------------------------------

SqlConnection scnn = newSqlConnection(strConn);
//SqlCommand scmdCloths = new SqlCommand();

SqlCommand SCmdUpdate = newSqlCommand();
SCmdUpdate.CommandText = "StoredPrrocedure1";
SCmdUpdate.CommandType = CommandType.StoredProcedure;
SCmdUpdate.Parameters.AddWithValue("@StrName", TxtName.Text);
SCmdUpdate.Parameters.AddWithValue("@StrFamily", TxtFamily.Text);
//SCmdUpdate.Parameters.AddWithValue("@bigintIdcloths", TxtName.SelectedText);

SCmdUpdate.Connection = scnn;
// scmdCloths.Connection = scnn;

scnn.Open();
SCmdUpdate.ExecuteNonQuery();
//SqlDataAdapter sdacloths = new SqlDataAdapter(scmdCloths);

//DataTable dtcloths = new DataTable();

//sdacloths.Fill(dtcloths);

//dataGridView1.DataSource = dtcloths;


scnn.Close();


نوع Exception من SQlExeption was unhandeled