PDA

View Full Version : خواندن از db و ذخیره در متغییر



saed2006
یک شنبه 19 آبان 1387, 09:30 صبح
این د ستور رو





SqlConnection objconnection = new SqlConnection("Data Source=PAL;Initial Catalog=mysoftbashgah;Integrated Security=True");
SqlCommand objcommand = new SqlCommand();
objcommand.Connection = objconnection;
objcommand.CommandText = "SELECT MAX(code) FROM honarjoo";




برای بدست اوردن یک مقدار از db نوشتم چطوری میتونم این مقدار رو در یک متغییر ذخیره کنم لطفا ادامه دستور رو بنویسید ممنون

mohammad272005
دوشنبه 20 آبان 1387, 03:04 صبح
int codeMax = Convert.ToInt32(objcommand.ExecuteScalar());