c# - Regarding select query in mssql and mysql and reserved keyword issue for table name -
in mysql have set set sql_mode = 'ansi'; query this:
select username, password "user" username = 'admin' , password = 'password123'
and query getting run in mysql , mssql. problem have problem in
sqlcommand cmd=new sqlcommand() cmd.commanttext=:select username, password "user" username = 'admin' , password = 'password123'";
and when using adp.fill(ds) givin me error of sql syntax.
so how can solve it. remember mytable name :=user mssql , mysql reserved keyword.so how can resolve this?
use sql server parameterized queries..
sqlcommand cmd = new sqlcommand(); cmd.commandtext = "select username, password user username = @admin , password = @pass"; cmd.parameters.addwithvalue("@admin", "admin"); cmd.parameters.addwithvalue("@pass", "password123");
Comments
Post a Comment