دلتنگ اسمان
یک شنبه 22 تیر 1393, 20:03 عصر
سلام
میخوام ماکزیمم عدد موجود در ستونی رو بخونم با این کد:sql2008 ,vs2008
SqlConnection con = new SqlConnection();
SqlCommand com = new SqlCommand();
con.ConnectionString = "server=localhost;Integrated security=true;database=matab";
com.Connection = con;
con.Open();
string sql = "select max(numfile) from personal";
numfileLbl.Text = (((int)com.ExecuteScalar() + 1).ToString());
com.CommandText = sql;
com.Connection = con;
ولی خطا میده. توی اکسس از این کد استفاده میکنم و مشکلی هم ندارم .
میخوام ماکزیمم عدد موجود در ستونی رو بخونم با این کد:sql2008 ,vs2008
SqlConnection con = new SqlConnection();
SqlCommand com = new SqlCommand();
con.ConnectionString = "server=localhost;Integrated security=true;database=matab";
com.Connection = con;
con.Open();
string sql = "select max(numfile) from personal";
numfileLbl.Text = (((int)com.ExecuteScalar() + 1).ToString());
com.CommandText = sql;
com.Connection = con;
ولی خطا میده. توی اکسس از این کد استفاده میکنم و مشکلی هم ندارم .