Last post Jul 10, 2014 03:46 AM by Perkinsville
Jul 04, 2014 01:41 PM|knucklehead321|LINK
I have built a small web forms application in VS Express 2013 Web to connect to a MySQL DB and process some data. The MySQL DB is hosted on our godaddy shared hosting server as well as the website. I have no issues connecting to the DB from my local machine
by using a reference to the MySql.Data.dll but when I publish the web forms app and add it to my website on godaddy I continually receive the "CS0246: The type or namespace name 'MySql' could not be found (are you missing a using directive or
an assembly reference?)" compilation error on the using directive "using MySql.Data.MySqlClient;".
When I publish the project in VS 2013 I make sure that the "Copy Local" property for the MySql.Data.dll file is set to true and when it finishes publishing that file does exist in the "bin" folder of the project.
My godaddy shared server is running .NET 4.0/4.5, I have complied the VS project in .NET 4.0 and the MySql.Data.dll file is also for .NET 4.0
Right now I am getting the connection string from a class in the web forms app .cs file for testing purposes.
I have posted my code below, any and all help is appreciated.
public partial class just_connect : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void connectButtonClick(object sender, EventArgs e)
DBConnection db = new DBConnection();
String connected = db.connectToDB();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Alert", "alert('" + connected + "');", true);
public class DBConnection
private String connection_string = null;
private String server = "server.db.someresources.com;";
private String database = "databasename;";
private String username = "dbusername;";
private String password = "dbpassword;";
public String getConnectionString()
connection_string = "SERVER=" + server + " DATABASE=" + database + " USER=" + username + " PASSWORD=" + password;
public String connectToDB()
String connstring = getConnectionString();
MySqlConnection con = new MySqlConnection(connstring);
catch (MySqlException ex)
return "Did not connect";
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="just_connect.aspx.cs" Inherits="DB_Connect_Application.just_connect" %>
<form id="form1" runat="server">
<asp:Button Text="Connect" OnClick="connectButtonClick" runat="server" />
Jul 10, 2014 03:46 AM|Perkinsville|LINK
Make sure the DLL is part of your deployment. Can you FTP to your web site on godaddy and check the contents?
Check in your BIN directory for the DLL.