Using variables in SQL queries in asp.net (C#)

后端 未结 4 1847
长情又很酷
长情又很酷 2021-01-05 13:47

I have an SQL query of this form

string cmdText = \"Select * from \" + searchTable 
  + \"WHERE \" + searchTable 
  + \"Name =\' \" +   searchValue + \"\'\";         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-05 14:19

    string cmdText = "Select * from " + searchTable + " WHERE Name = '" +   searchValue + "'";
    

提交回复
热议问题