C# 怎么调用自己定义的函数
//查询用户密码是否存在publicintmenoth(stringnamea,stringqpwd){intfalg=0;stringsqlret="select*fr...
//查询用户密码是否存在
public int menoth(string namea, string qpwd)
{
int falg = 0;
string sqlret = "select * from byUser where UserName = '" + namea + "' and PassWord = '" + qpwd + "'";
falg = GetDataInfo(sqlret);
//查询4次
if (falg == 1)
{
sqlret = "select * from UserName datapwd order by Usertime asc";
DataTable ds=new DataTable();
if (ds.Rows.Count > 0 )
{
for (int i = 5; i < ds.Rows.Count; i++)
{
string myStr = ds.Rows[i][0].ToString();
}
}
}
return falg;
}
//删除查询的最后一条
public bool Delete(DataTable table)
{
string sql = "delete * from datapwd where id= '" ;
SqlCommand cmd = new SqlCommand(sql);
int num = cmd.ExecuteNonQuery();
if (num < 1)
return false;
else
return true;
}
写完了 我怎么调用它 要实现 修改密码 我去用户表查询4次 然后删除最后一条 求大神给予答案 展开
public int menoth(string namea, string qpwd)
{
int falg = 0;
string sqlret = "select * from byUser where UserName = '" + namea + "' and PassWord = '" + qpwd + "'";
falg = GetDataInfo(sqlret);
//查询4次
if (falg == 1)
{
sqlret = "select * from UserName datapwd order by Usertime asc";
DataTable ds=new DataTable();
if (ds.Rows.Count > 0 )
{
for (int i = 5; i < ds.Rows.Count; i++)
{
string myStr = ds.Rows[i][0].ToString();
}
}
}
return falg;
}
//删除查询的最后一条
public bool Delete(DataTable table)
{
string sql = "delete * from datapwd where id= '" ;
SqlCommand cmd = new SqlCommand(sql);
int num = cmd.ExecuteNonQuery();
if (num < 1)
return false;
else
return true;
}
写完了 我怎么调用它 要实现 修改密码 我去用户表查询4次 然后删除最后一条 求大神给予答案 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询