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

Shaitan00

Junior Contributor
Joined
Aug 11, 2003
Messages
358
Location
Hell
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...

Code:
<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());
m_MySqlConnection.Open();

System.Data.DataSet ds = new System.Data.DataSet();
MySqlDataAdapter mysqlDA = new MySqlDataAdapter("SELECT * FROM employees;", m_MySqlConnection);
mysqlDA.Fill(ds);

m_MySqlConnection.Close();
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...
Thanks,
 
Back
Top