combo_ci
چهارشنبه 17 مهر 1387, 13:16 عصر
سلام
من قطعه كد تو تئ يه سايتي ديدم....ولي منظور از كد رو (يعني كاربرد كد رو )متوجه نشدم..
از دوستان كسي ميدونه كاربرد اين كد كجاهاست؟
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = "Server=.;Database=amozesh;Asynchronous Processing=true;User ID=sa;Password=1234";
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO dore (srl,Name,start_date)VALUES(201,'"+textBox1.Text+"','"+textBox2.Text+"')";
if (con.State != ConnectionState.Open)
con.Open();
System.IAsyncResult AsyncResult = cmd.BeginExecuteNonQuery();
while (!AsyncResult.IsCompleted)
{
System.Threading.Thread.Sleep(500);
}
cmd.EndExecuteNonQuery(AsyncResult);
if (con.State != ConnectionState.Closed)
con.Close();
MessageBox.Show("Finish!");
من قطعه كد تو تئ يه سايتي ديدم....ولي منظور از كد رو (يعني كاربرد كد رو )متوجه نشدم..
از دوستان كسي ميدونه كاربرد اين كد كجاهاست؟
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = "Server=.;Database=amozesh;Asynchronous Processing=true;User ID=sa;Password=1234";
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO dore (srl,Name,start_date)VALUES(201,'"+textBox1.Text+"','"+textBox2.Text+"')";
if (con.State != ConnectionState.Open)
con.Open();
System.IAsyncResult AsyncResult = cmd.BeginExecuteNonQuery();
while (!AsyncResult.IsCompleted)
{
System.Threading.Thread.Sleep(500);
}
cmd.EndExecuteNonQuery(AsyncResult);
if (con.State != ConnectionState.Closed)
con.Close();
MessageBox.Show("Finish!");