Last post Mar 15, 2019 05:56 AM by lingmaaki
Oct 06, 2018 11:50 PM|Poly|LINK
I'm trying to connect to a MySQL database using visual studio community 2017
I have downloaded the MySQL Visual Studio v1.2.8 from here
I have download the connector from here v8.0.12 (and tried 6.9.12 and 6.8.8)
I now see MySQL when trying to add a MySQL database - I can connect to my database from visual studio no problem it looks fine - all the table are showing up
The problem occurs when I try to use the database with the SqlDataSource
I select the source and use my above database as the connection string
The below markup is created in my aspx page and I see a connection string in my web.config file
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString='<%$ ConnectionStrings:dbAirMasjidConnectionString %>'
ProviderName='<%$ ConnectionStrings:dbAirMasjidConnectionString.ProviderName %>'
SelectCommand="SELECT * FROM [tblRegistrations]"></asp:SqlDataSource>
However when I try to run a test query a get the error
"Unable to retrieve schema. Ensure that the ConnectionString and SelectCommand properties are valid"
"Object reference not set to an instance of the object"
I have downloaded VS2015 and seeing the same results
I have been through the steps in
but still nothing
Oct 08, 2018 04:10 AM|Ackerly Xu|LINK
First you should provide MySql.Data.MySqlClient dll in your web.config. Please use your own version of MySqlClient.
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=188.8.131.52, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /><!--please use your own version-->
If it doesn't work, it seems to be a bug in the latest version of Connector/NET.
You could follow the post bellow .
Here is the bug posted to mysql.
Or go to mysql forums for help.
Mar 15, 2019 05:56 AM|lingmaaki|LINK
The message "Object not set to instance of Object" means that you are trying to use an object which has not been initialized. That is, you either set it to null, or you never set it to anything at all. The runtime throwing a
NullReferenceException always means the same thing: you are trying to use a reference. The reference is not initialized (or it was initialized, but is no longer initialized). This points to one of the