Results 1 to 3 of 3

Thread: Query of Tables always returns count=0 from MySQL Database using ASP.NET 2005

  1. #1
    Join Date
    Jul 2006

    Question Query of Tables always returns count=0 from MySQL Database using ASP.NET 2005

    I am encountering an odd issue where no matter what data I query from my MySQL database via ASP.NET [2005] I always get back a count of 0...

    To start off, I open the MySQL 5.1 Command Line Client, enter my password ("pass") and then select my database (USE bank;). From here I do a the following query:
    SELECT * FROM employees;
    And it returns 18 rows of results (as expected).

    Now in my application (for which I installed the "MySQL Connector Net 5.1.6" which should work with ASP.NET 2005 right?) I added the reference and code (as seen below) to try and mimic the exact same thing as I did manually above. However in this case the result (count of dataset ds) is always 0...

    <add name="MySQLConnectionString" connectionString="server=localhost; user id=root; password=pass; database=bank; pooling=false;" providerName="MySql.Data.MySqlClient"/>
    MySqlConnection m_MySqlConnection = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ToString());
    System.Data.DataSet ds = new System.Data.DataSet();
    MySqlDataAdapter mysqlDA = new MySqlDataAdapter("SELECT * FROM employees;", m_MySqlConnection);
    return ds;
    I checked "m_MySqlConnection" and the STATE is open (so I assume it connected properly to my database - therefore not a problem with the connection string and/or authentication correct?) but no matter what my ds has a count = 0...?...?
    I was doing some reading and some people needed to add a user with permissions to allow the ASP page to connect to the database - I didn't do that but I assume if there was a problem with that I wouldn't be able to connect and my STATE wouldn't be open...

    At this point I am a little lost as to what I could be missing/forgetting...
    Any help would be greatly appreciated...

  2. #2
    Join Date
    Aug 2005
    The Garden State
    are you sure you're pointing to the right server? is it really localhost, in both cases?
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  3. #3
    Join Date
    Jul 2006


    Thats a good question ...
    I should only have one running database on my PC and it is local (everything is being done on my machine) - and seeing as "m_MySqlConnection" connects (state) I would have assumed that it meant it was connecting to database=bank (which I can't imagine I have two of).

    But in the off case - how can I be 100% sure?
    What aside from localhost can/should I use?


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center