Ehsan Programmer
سه شنبه 24 فروردین 1389, 11:16 صبح
سلام
من تو SQL Server یک میتدی ام
میخوام برای شروع کار از سی شارپ به یک دیتابیس که یک جدول با دو فیلد است مقدار اضافه کنم
مراحل اولیه رو انجام دادم و حالا رسیدم به خاصیت CommandText که نمیدونم کارش چیه
میشه لطفا توضیح بدین
اینم کدها
try
{
SqlConnection con = new SqlConnection("server=(local);database=MyDB1;Integrated Security=True;");
SqlCommand cm = new SqlCommand();
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "IS_StuGrades"; // stored procedure name
cm.Connection = con; //set the connection property
if (con.State == ConnectionState.Closed) // if connection is closed then open it
con.Open();
// pass parametere and their values to store procedure
cm.Parameters.AddWithValue("@StudentID", int.Parse(textBox1 .Text.Trim()));
cm.Parameters.AddWithValue("@Grade", int.Parse ( textBox2.Text));
من تو SQL Server یک میتدی ام
میخوام برای شروع کار از سی شارپ به یک دیتابیس که یک جدول با دو فیلد است مقدار اضافه کنم
مراحل اولیه رو انجام دادم و حالا رسیدم به خاصیت CommandText که نمیدونم کارش چیه
میشه لطفا توضیح بدین
اینم کدها
try
{
SqlConnection con = new SqlConnection("server=(local);database=MyDB1;Integrated Security=True;");
SqlCommand cm = new SqlCommand();
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "IS_StuGrades"; // stored procedure name
cm.Connection = con; //set the connection property
if (con.State == ConnectionState.Closed) // if connection is closed then open it
con.Open();
// pass parametere and their values to store procedure
cm.Parameters.AddWithValue("@StudentID", int.Parse(textBox1 .Text.Trim()));
cm.Parameters.AddWithValue("@Grade", int.Parse ( textBox2.Text));