Hello
See this code in a C# program: how can i use the value 'John' in this sql-statement? I tried this but gives nothing
sql="select name from clients where clients=' " + "John' ";
Thanks
V
Hello
See this code in a C# program: how can i use the value 'John' in this sql-statement? I tried this but gives nothing
sql="select name from clients where clients=' " + "John' ";
Thanks
V
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Jul 6, 2021, 1:53 PM
If you have a little knowledge of SQL-Injection attacks then you must be knowing that your code is not only wrong but also vulnerable to the attack, never build the query by concatenating user inputs, a malicious user may enter a SQL query instead of a username.
Always use a parameterized query or Stored procedures when working with ADO.Net
Note:- cs is connection string and rdr[n] means nth column in DB.
Valerie MeunierPosted Jul 8, 2021, 11:14 AM