Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to use MySql.Data.MySqlClient on aspx page 1

Status
Not open for further replies.

gib99

Programmer
Mar 23, 2012
51
CA
I've got a MySQL database running on my laptop and I want to connect to it via some C# scripting.

I have an aspx page that has this at the top:

Code:
<%@ Page Language="C#" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>

<html>

<script runat="server">

void Page_Load(object sender, System.EventArgs e)
{
	MySql.Data.MySqlClient.MySqlConnection con = new MySql.Data.MySqlClient.MySqlConnection();
}

</script>

But I get an error when I try to open this page:

Code:
Compiler Error Message: CS0246: The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

 

Line 2:  
Line 3:  <%@ Import Namespace="System.Data" %>
Line 4:  <%@ Import Namespace="MySql.Data.MySqlClient" %>
Line 5:  
Line 6:  <html>

I'm assuming that if I have MySQL running on my machine, I have the MySql.Data.MySqlClient library. If so, I can I get my aspx page to access it. If not, how do I get it (and then use it)?
 
did you reference the MySql library in your project? If you are not using Visual Studio to create a project, is the library in the GAC (Global Assembly Cache) (%windir%\assembly)? Or somewhere in your site folder?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top