string con=".......";//数据库链接
string str="select max(列名) as maxvalue from table";
SqlConnection cn=new SqlConnection(con);
cn.Open();
SqlDataAdapter sda =new SqlDataAdapter(str,cn);
DataSet ds=new DataSet()
sda.Fill(ds,"TableName");
textBox1.Text=ds.Tables[0].Rows[0]["maxvalue"].ToString();
string str="select max(列名) as maxvalue from table";
SqlConnection cn=new SqlConnection(con);
cn.Open();
SqlDataAdapter sda =new SqlDataAdapter(str,cn);
DataSet ds=new DataSet()
sda.Fill(ds,"TableName");
textBox1.Text=ds.Tables[0].Rows[0]["maxvalue"].ToString();
然后再把查到的结果覆给textbox 的 text 属性就可以了。
取到的就是记录中的最大值。