简体   繁体   中英

c# SQLCOMMAND giving error

Sqlcommand cmd=new Sqlcommand();
cmd.commandtext="select username, password from \"user\" where username = 'admin' 
 and password = 'password123' ";
adp.fill(ds);

Now above query is getting succesffuly executed in mysql and mssql,but my C# code is giving error incorrect sytax "user" Where I am wrong? NOTE:-I want above query to run in mysql and mssql both,and also note that user is reserved keyword in sql

For MySQL use

from `user`

For SQL Server use

from [user]

For Oracle use

from "user"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM