+ Reply to Thread
Results 1 to 6 of 6

Thread: Connecting ASP.NET and MySQL

  1. #1
    Tails07's Avatar
    Tails07 is offline x10Hosting Member Tails07 is an unknown quantity at this point
    Join Date
    Sep 2006
    Location
    United Kingdom
    Posts
    8

    Connecting ASP.NET and MySQL

    I have been trying to set up a simple ASP.NET page with a connection to a MySQL database but I can't get it to work. I have been following the example from this post:

    How to get ASP.Net to work at x10Hosting

    And here is my web.config:
    Code:
    <?xml version="1.0" ?>
    <configuration>
      <system.web>
        <customErrors mode="Off"/>
    
        <compilation>
          <assemblies>
            <add assembly="MySql.Web"/>
            <add assembly="MySql.Data"/>
          </assemblies>
        </compilation>
      </system.web>
    </configuration>
    And my page Mysql.aspx:
    Code:
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="MySql.Data.MySqlClient" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
        <title>MySQL Testing</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
        <script runat="server">
        private void Page_Load(Object sender, EventArgs e)
        {
            string connectionString = "server=localhost;Database=tails07_test;userid=tails07_admin;password=notlistedforsecurityreasons;Pooling= false;";
           MySqlConnection dbcon = new MySqlConnection(connectionString);
           dbcon.Open();
    
           MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM table1", dbcon);
           DataSet ds = new DataSet();
           adapter.Fill(ds, "table1");
           dbcon.Close();
           dbcon = null;
    
           ArtistsControl.DataSource = ds.Tables["table1"];
           ArtistsControl.DataBind();
        }
        </script>
    
      </head>
    
      <body>
          <form id="form1" runat="server">
        <h1>Artists</h1>
        <asp:DataGrid runat="server" id="ArtistsControl" />
      </form>
      </body>
    
    </html>
    The page url is: http://zephyr.x10hosting.com/Mysql.aspx

    Error message is:
    Code:
    Exception of type 'System.Exception' was thrown.
    
     Description: HTTP 500. Error processing request.
     Stack Trace: 
     System.Exception: Exception of type 'System.Exception' was thrown.
      at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0
    Can anyone help me get this connection working?

  2. #2
    vishal's Avatar
    vishal is offline -::-X10 Guru-::- vishal has a brilliant futurevishal has a brilliant future
    Join Date
    Nov 2009
    Location
    INDIA
    Posts
    5,250

    Re: Connecting ASP.NET and MySQL

    Currently ASP.net have some problems
    Regards ~ Vishal
    Giving Reputation (at bottom of my post ) is the best way to encourage the person who helped you on forums.

  3. #3
    alexandrefc is offline x10Hosting Member alexandrefc is an unknown quantity at this point
    Join Date
    Mar 2010
    Posts
    2

    Re: Connecting ASP.NET and MySQL

    Quote Originally Posted by vishal2 View Post
    Currently ASP.net have some problems
    any forecast for the return?

  4. #4
    Tails07's Avatar
    Tails07 is offline x10Hosting Member Tails07 is an unknown quantity at this point
    Join Date
    Sep 2006
    Location
    United Kingdom
    Posts
    8

    Re: Connecting ASP.NET and MySQL

    Any news on when this will be fixed?

  5. #5
    mernz is offline x10Hosting Member mernz is an unknown quantity at this point
    Join Date
    Apr 2010
    Posts
    3

    Re: Connecting ASP.NET and MySQL

    guys, any updates with this issue?

  6. #6
    worabi is offline x10Hosting Member worabi is an unknown quantity at this point
    Join Date
    May 2010
    Posts
    1

    Re: Connecting ASP.NET and MySQL

    Is this still not working?

+ Reply to Thread

Similar Threads

  1. MySQL not connecting
    By rokkwarr in forum Free Hosting
    Replies: 6
    Last Post: 01-30-2010, 11:08 PM
  2. mySQL still not connecting
    By Algorath in forum Free Hosting
    Replies: 8
    Last Post: 01-27-2010, 11:00 PM
  3. Connecting local mysql client to mysql database
    By nadunalexander in forum Free Hosting
    Replies: 4
    Last Post: 01-01-2010, 05:24 PM
  4. ASP.NET - connecting to MySQL
    By gamemap in forum Programming Help
    Replies: 1
    Last Post: 08-06-2009, 04:41 AM
  5. Connecting Mysql
    By ReDeR in forum Free Hosting
    Replies: 1
    Last Post: 05-08-2009, 02:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers