Rajubhai
Rajubhai

Reputation: 107

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

Upvotes: 0

Views: 63

Answers (1)

juergen d
juergen d

Reputation: 204746

For MySQL use

from `user`

For SQL Server use

from [user]

For Oracle use

from "user"

Upvotes: 2

Related Questions