链接数据库时我们已经写了一个类 ,谁能帮我一下我红色区域是做什么用的!!try
{
sql = "select pwd from [user] where myname=@myname";
DbCommand cmd = db.GetSqlStringCommond(sql);
db.AddInParameter(cmd, "@myname", DbType.String, Name);
ds = db.ExecuteDataSet(cmd); if (ds.Tables[0].Rows.Count> 0)
{
password = ds.Tables[0].Rows[0]["pwd"].ToString();
}
}
catch(Exception e)
{
throw new ApplicationException(e.Message); }
return password;
{
sql = "select pwd from [user] where myname=@myname";
DbCommand cmd = db.GetSqlStringCommond(sql);
db.AddInParameter(cmd, "@myname", DbType.String, Name);
ds = db.ExecuteDataSet(cmd); if (ds.Tables[0].Rows.Count> 0)
{
password = ds.Tables[0].Rows[0]["pwd"].ToString();
}
}
catch(Exception e)
{
throw new ApplicationException(e.Message); }
return password;
db.AddInParameter(cmd, "@myname", DbType.String, Name); 给cmd添加一个String类型参数名为@myname的参数,值为Name
ds = db.ExecuteDataSet(cmd); ds等于执行后返回的结果集。