可以用笨办法
string sql="select * from table where [COLUMNNAME]='abc'";
function string getSql(string columnname)
{
string result=sql.Replace("[COLUMNNAME]",columnname);
return result;
}
string sql="select * from table where [COLUMNNAME]='abc'";
function string getSql(string columnname)
{
string result=sql.Replace("[COLUMNNAME]",columnname);
return result;
}
Temp1="name";
string sql = "select * from yourtable where " + Temp1 +"='abc'";Temp2="address";
sql = "select * from yourtable where " + Temp2 + "='abc' ";sql = "select * from yourtablee where " + Temp1 + "='abc' And " + Temp2 +"='def'";
string Temp1 = "name";string strSql = strSqlTemp + Temp1 + " = 'abc' ";
如果是在存储过程中使用的话可以用exec(sql)执行