0

Here is a similar question Keyword not supported: 'server'. I use MySQL, when i use a connectionString to build a connection to database, there will be an exception:Keyword not supported: 'server'. I also try use data source to instead server, but it doesn't work. How to solve this problem?

Community
  • 1
  • 1
Roger.Kang
  • 62
  • 1
  • 5
  • post your connection string – Tharif Mar 31 '15 at 09:20
  • I'm not sure but this might be case sensitive so instead of server type Server – MajkeloDev Mar 31 '15 at 09:28
  • @utility my connectionString is "server=xxx.xxx.xxx.xxx;User Id=root;password=***;database=xxxxxx"; – Roger.Kang Mar 31 '15 at 10:30
  • @MajkeloDev it's not case sensitive – Roger.Kang Mar 31 '15 at 10:31
  • try adding : providerName="System.Data.EntityClient" with con string – Tharif Mar 31 '15 at 10:36
  • @utility it doesn't work. – Roger.Kang Mar 31 '15 at 10:38
  • replace server with host – Tharif Mar 31 '15 at 10:40
  • If it is similar to the question you linked: do you have that connection string in an App.config? If so, try connectionString="provider=System.Data.SqlClient;provider connection string="data source=xxx.xxx.xxx.xxx;UserId..." instead. – LocEngineer Mar 31 '15 at 10:50
  • @LocEngineer I have app.config file and have tried the method you mentioned, but it doen's work. – Roger.Kang Apr 13 '15 at 12:06
  • Please be more specific. Have you made sure to use "MySql" as provider instead of "System.Data.SqlClient" which I accidentally copied from my config without adapting to your needs? Have you also used "&quot" in your connection string instead of clear text quotes? Is your path to the db correct? What exactly does "doesn't work" mean? – LocEngineer Apr 13 '15 at 13:03
  • @LocEngineer my connectionString is "provider=System.Data.SqlClient;provider connection string="data source=xxx.xxx.xxx.xxx;;User Id=xxx;password=xxx;database=xxx". I get an exception : "System.ArgumentException" type of unhandled exception occurs in System.Data.dll in. Other information: Keyword not supported: "data source". – Roger.Kang Apr 14 '15 at 09:03
  • Well there you go. You said "I use MySQL", therefore System.data.SqlClient is wrong for you. It should instead be "Provider=MySql.Data.MySqlClient;provider connection string="Server=mydb;User Id=myUsername;Password=myPassword;database=xxx"" Does that work? – LocEngineer Apr 14 '15 at 09:34

0 Answers0