public DataSet GetSelectBaseIndex(string Branch, string Name)
{
string Condition = " where 1=1 ";
if (Branch != "")
{
Condition += " and Branch = '" + Branch.Replace("'", "''") + "' ";
}
if (Name!= "")
{
Condition += " and Name= '" + Name.Replace("'", "''") + "' ";
}
string SelectString = "select * from Table " + Condition + " order by Name";
return SqlHelper.ExecuteDataset(this.connectionString, CommandType.Text, SelectString);
}
以下是我自己写的代码可以参考一下 (要注意代码放置的语句,否则会导致textbox不显示)