作业帮 > 综合 > 作业

谁能帮我看看那这些代码什么意思?

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/18 07:35:44
谁能帮我看看那这些代码什么意思?
public static SqlConnection createdb()
{
string dbstring = ConfigurationSettings.AppSettings["cn"];
SqlConnection conn = new SqlConnection(dbstring);
return conn;
}
public static bool delly(int id)
{
try
{
SqlConnection conn = createdb();
conn.Open();
SqlCommand cmd = new SqlCommand("delete from book where id=" + id,conn);
cmd.ExecuteNonQuery();
conn.Close();
return true;
}
catch
{
return false;
}
}
}
public StrRegExp()
\x05{
\x05\x05//
\x05\x05// TODO:在此处添加构造函数逻辑
\x05\x05//
\x05}
public static bool IsID(string PostStr)
{
string RegStr = @"^[0-9]*[1-9][0-9]*$";
if (Regex.IsMatch(PostStr,RegStr))
{
return true;
}
else
{
return false;
}
创建连接数据库;
打开数据库;
删除book表中id等于指定的所有记录
最后关闭数据库.
再问: public static bool IsID(string PostStr) { string RegStr = @"^[0-9]*[1-9][0-9]*$"; if (Regex.IsMatch(PostStr, RegStr)) { return true; 这些什么意思