Hi, I am attempting to replace the database in an application with MariaDB. This application is written in C# and previously accessed the database (mostly inserts) with LINQ. When I attempt to insert (other transactions have the same type of issue) I get the error message:

"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[t0].[Id], [t0].[BirthYear], [t0].[FirstName], [t0].[Gender], [t0].[LastName], [' at line 1"

The table in MariaDB is setup the same as it was in MS SQL.

Any thoughts on this subject would be most appreciated. I could go back and remove all use of LINQ and write SQL by hand, but if I can get it to work as is it will save a great deal of time, and therefore money.

Thanks in advance.

Recommended Answers

All 6 Replies

Have you set the connection to use the MySQL provider? MariaDB may not be compatible with MSSQL Server commands.

Yes, the connection is set to MySQL, but linq continues to spit out incorrect SQL ([ and ] rather than ' or "). Is there a settings I'm perhaps missing somewhere?

What's your connection string and what version is the MySQL Connector you are using?

Connection string: server=localhost;port=3306;database=physiodata;uid=root;pwd=root
MySQL Connector version: .net 6.6.5

Not planning to use root as the user, or the password for root, just trying to get this up and will change it later.

I went ahead and added "sqlservermode=True;" to my connectionstring, now it works. Thanks

Glad you got the problem sorted, please mark this thread as answered in order to keep the forums tidy :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.