I am trying to display a basic gridview with data queried from MySql. My code and the subsequent error follow. I have the MySql assembly loaded into references.
<%@ Page Language="C#" Inherits="webapp1.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Default</title> </head> <body> <form id="form1" runat="server"> <asp:TextBox id="textBox1" runat="server"/> <asp:Button id="button1" runat="server" OnClick="onButtonClick"/> <asp:Gridview id="GridView1" runat="server" autogeneratecolumns="true" datasourceid="mydatasource"> <Columns> <asp:BoundField DataField="name_id" HeaderText="id" SortExpression="name_id" /> <asp:BoundField DataField="first_name" HeaderText="first" SortExpression="first_name" /> <asp:BoundField DataField="last_name" HeaderText="last" SortExpression="last_name" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="mydatasource" runat="server" ConnectionString="Server=localhost;Database=films;User ID=user;Password=password;Pooling=false;" ProviderName="MySql.Data.MySqlClient" SelectCommand="SELECT * FROM names"></asp:SqlDataSource> </form> </body> </html> Server error in '/' application Description: Error processing request. Error Message: HTTP 500. Stack Trace: System.Data.SqlClient.SqlException: Server does not exist or connection refused. ---> Mono.Data.Tds.Protocol.TdsInternalException: Server does not exist or connection refused. ---> System.Net.Sockets.SocketException: Connection refused at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remote_end) [0x00000] at Mono.Data.Tds.Protocol.TdsComm..ctor (System.String dataSource, Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) [0x00000] --- End of inner exception stack trace --- at Mono.Data.Tds.Protocol.TdsComm..ctor (System.String dataSource, Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) [0x00000] at Mono.Data.Tds.Protocol.Tds..ctor (System.String dataSource, Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) [0x00000] at Mono.Data.Tds.Protocol.Tds70..ctor (System.String server, Int32 port, Int32 packetSize, Int32 timeout) [0x00000] at (wrapper remoting-invoke-with-check) Mono.Data.Tds.Protocol.Tds70:.ctor (string,int,int,int) at System.Data.SqlClient.SqlConnection.Open () [0x00000] --- End of inner exception stack trace --- at System.Data.SqlClient.SqlConnection.Open () [0x00000] at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, Int32 startRecord, Int32 maxRecords, System.String srcTable, IDbCommand command, CommandBehavior behavior) [0x00000] at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, System.String srcTable) [0x00000] at (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string) at System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect (System.Web.UI.DataSourceSelectArguments arguments) [0x00000] -- View this message in context: http://www.nabble.com/Problem-using-MySql-with-a-GridView-tf3678498.html#a10279570 Sent from the Mono - General mailing list archive at Nabble.com. _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
