Bug #17427 MySql connect problem
Submitted: 15 Feb 2006 14:58 Modified: 23 Feb 2006 20:22
Reporter: Mark B Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.7 OS:Windows (Windows xp)
Assigned to: Reggie Burnett CPU Architecture:Any

[15 Feb 2006 14:58] Mark B
Description:
Re: error message and registering the Connecter/net in the gobal assembley cache.

Problem:-
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: BC30002: Type 'MySqlConnection' is not defined.
Source Error:
Line 6:  Sub Page_Load(sender As Object, e As EventArgs)
Line 7:  
Line 8:      Dim myConnection  As MySqlConnection
Line 9:      Dim myDataAdapter As MySqlDataAdapter
Line 10:     Dim myDataSet     As DataSet
 
Why is it nessary to copy the "C:\Program Files\MySQL\MySQL Connector Net 1.0.7\bin\.NET 2.0\MySql.Data.dll" to "C:\Inetpub\wwwroot\bin" in order to get the connector working?

This is the vb example I am following:-

http://www.15seconds.com/issue/050407.htm

My isp have installed the connector but appear to be reluctant to copy the dll across.

Is this a fault?

What is "asp.net project" folder?
http://forums.mysql.com/read.php?38,60476,61646#msg-61646

What is the local bin folder?
http://forums.mysql.com/read.php?38,69866,69888#msg-69888

Regards

Mark

How to repeat:
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">

Sub Page_Load(sender As Object, e As EventArgs)

    Dim myConnection  As MySqlConnection
    Dim myDataAdapter As MySqlDataAdapter
    Dim myDataSet     As DataSet

    Dim strSQL        As String
    Dim iRecordCount  As Integer

    myConnection = New MySqlConnection("server=localhost; user id=15secs; password=password; database=mydatabase; pooling=false;")

    strSQL = "SELECT * FROM mytable;"

    myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
    myDataSet = New Dataset()
    myDataAdapter.Fill(myDataSet, "mytable")

    MySQLDataGrid.DataSource = myDataSet
    MySQLDataGrid.DataBind()

End Sub

</script>

<html>
<head>
<title>Simple MySQL Database Query</title>
</head>
<body>

<form runat="server">

<asp:DataGrid id="MySQLDataGrid" runat="server" />

</form>

</body>
</html> 

Suggested fix:
Is the installation at fault or its just a manal copy?
[23 Feb 2006 20:22] Reggie Burnett
Mark

you don't need to have your ISP install anything.  You should compile your web app on a dev machine referencing the connector properly.  If you are using Visual Studio, then you'll just use the references project node and attach the connector assembly.  Once you've compiled your web app, you would just upload it to your isp.  The assemblies for your web app along with the connector assembly would be uploaded to the bin folder under your hosting account.