TableName = CourseMaster
Column Name = CourseCode
每次需要最大值= 9 ..!和 9 + 1 = 10 ..(值增加 1 )..!
为什么 nt 取 MAX 值 10 ?? 任何人请帮忙,告诉我我哪里错了......??
// Finding Max Term CourseCode
string query1 = "SELECT MAX(CourseCode) FROM CourseMaster ";
SqlCommand comm1 = new SqlCommand(query1, connection);
comm1.CommandType = CommandType.Text;
string s;
s = comm1.ExecuteScalar().ToString();
label3.Text = s;
int i;
i = Convert.ToInt32(s) + 1;
s = i.ToString();
label7.Text = s;
comm1.ExecuteNonQuery();
comm1.Connection.Close();