简单参数问题
public DataSet chaxun(string name)
{
try
{
strCon.Open();
string strSql = "SELECT zh FROM Userinfo where zh='name'";
DataSet ds = new DataSet();
SqlDataAdapter s = new SqlDataAdapter(strSql, strCon);
s.Fill(ds);
return ds;
}
}
如何把 查询语句(string strSql = "SELECT zh FROM Userinfo where zh='name'")的name变成(public DataSet chaxun(string name))参数name
SQL
查询语句
------解决方案-------------------- string strSql = string.format("SELECT zh FROM Userinfo where zh='{0}'",name);
------解决方案--------------------string strSql = "SELECT zh FROM Userinfo where zh='"+
name+"'';
字符串的一些常用操作你需要学习一下