public static SqlConnection conn;
public static string ConStr;//数据库连接字符串
public static string ComStr="select Jid from 表名称 ";//数据库字段查询字符串
public string GetTop()
{string Str;//获取到的字符串
conn = new SqlConnection(ConStr);
conn.Open();
SqlCommand cmd = new SqlCommand(ComStr, conn);
Str=cmd.ExecuteScalar().ToString();
cmd.Dispose();
Con_Close();
return Str;}
温馨提示:答案为网友推荐,仅供参考