M
msch-prv
Hi, I am trying to tie a SQLDataSource control to MySQL without
success. The connection string works ok with an ObjectDataSource.
(Native asp.net 2.0 MySQL dll loaded in /bin)
For some reason, the compiler believes an SQL db is being accessed ("An
error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact
that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)").
How can I modify the code so that the compiler "sees" a MySQL db?
Thanks for any hints, Mark
web.config:
<connectionStrings>
<add name="MySQLConn" connectionString=
"SERVER=localhost;DATABASE=dbKatoka;UID=admin;PWD=admin;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
aspx:
<%@ Import Namespace="MySql.Data.MySqlClient" %>
..
<asp:SqlDataSource id="Apts_City"
ConnectionString ="<%$ ConnectionStrings:MySQLConn %>"
SelectCommand="SELECT DISTINCT AptCity FROM tblApt;"
runat="server"/>
<asp
ropDownList id="DropDown1" DataSourceID="Apts_City"
DataTextField="AptCity" DataValueField="AptCity"
runat="server" />
success. The connection string works ok with an ObjectDataSource.
(Native asp.net 2.0 MySQL dll loaded in /bin)
For some reason, the compiler believes an SQL db is being accessed ("An
error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact
that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)").
How can I modify the code so that the compiler "sees" a MySQL db?
Thanks for any hints, Mark
web.config:
<connectionStrings>
<add name="MySQLConn" connectionString=
"SERVER=localhost;DATABASE=dbKatoka;UID=admin;PWD=admin;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
aspx:
<%@ Import Namespace="MySql.Data.MySqlClient" %>
..
<asp:SqlDataSource id="Apts_City"
ConnectionString ="<%$ ConnectionStrings:MySQLConn %>"
SelectCommand="SELECT DISTINCT AptCity FROM tblApt;"
runat="server"/>
<asp

DataTextField="AptCity" DataValueField="AptCity"
runat="server" />