| Bug #43396 | MysqlConnection() undefined, Import Mysql.data.MysqlClient not work | ||
|---|---|---|---|
| Submitted: | 4 Mar 2009 23:12 | Modified: | 6 Apr 2009 14:29 |
| Reporter: | Thomas Lee | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / NET | Severity: | S1 (Critical) |
| Version: | 5,2 | OS: | Windows (XP ver 2002, SP2) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | MysqlConnection () not recognized | ||
[5 Mar 2009 8:37]
Tonci Grgin
Hi Thomas and thanks for your report. I do not have express edition nor do I have a place to put it in so please try adding using MySql.Data; too and see if it helps.
[5 Mar 2009 8:58]
Tonci Grgin
Pardon me, not "using" but "imports". However I see no immediate error in your test case comparing it to mine:
Imports MySql.Data.MySqlClient
--
Dim strcon, strSQL As String
Dim objConnector As MySqlConnection
Dim objDR As MySqlDataAdapter
Dim objDT As DataTable
Dim objCommand As MySqlCommand
Dim str As String
Dim objMysqlEx As MySqlException
Dim i As Integer
Dim strJaps, strEnglish, strHeb As String
strcon = "User ID=root;Password=**;Host=**;Database=test;Port=**"
objConnector = New MySqlConnection(strcon)
objConnector.Open()
works as expected in VS2005Pro.
What says "Properties/References" of you project? Is MySQL.Data there?
[18 Mar 2009 20:36]
Thomas Lee
I already Imports as you suggest. In VS 2005 Express,it may due to its simplified version of Professional but why it is not work in VS 2003 edition either. Both I have same "undefined" message. Thomas
[18 Mar 2009 20:58]
Thomas Lee
The Mysql.data is not shown in property/reference of Prj
[18 Mar 2009 21:26]
Thomas Lee
Additional message is "Imports Mysql..." not found. In Window / ODBC, if I try to add one connection , I dont see Net/ connector driver exist except older 3.51 driver. Are the both drivers co-exist cause problem ?
[6 Apr 2009 14:29]
Tonci Grgin
Thomas, you should be able to add reference, if in no other way, then by browsing your disk for MySQL.data.dll. I can not repeat this problem, sorry. Having MyODBC connector 3.51 and .NET connector on same box is of no relevance and they in no way interfere with each other.

Description: I installed Net/connector 5.2 with MySql server 5.0 run in Visual Studio 2005 Express or VS 2003 edition VB code as follow Imports System.ComponentModel Imports System.Drawing Imports System.Windows.Forms Imports System.Data Imports Mysql.Data.MySqlClient Imports System Private Sub cbDataReader_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDataReader.Click Dim SQL As String = "Select EmployeeId, LastName, FirstName, Title,BirthDate from Employees" Dim aDate As DateTime Dim Connectionstring As String ConnectionString = "server=127.0.0.1;" _ & "uid=Thomas;" _ & "pwd=system2;" _ & "database=northwind;" '_ Dim oConn As New MysqlConnection(Connectionstring) Dim oCmd As New MysqlCommand(SQL, oConn) Dim oRD As MysqlDataReader Dim lvItem As ListViewItem Call lvEmps.Items.Clear() Try oConn.Open() oRD = oCmd.ExecuteReader(CommandBehavior.CloseConnection) Do While (oRD.Read()) lvItem = New ListViewItem(oRD.Item("EmployeeId").ToString) lvItem.SubItems.Add(oRD.Item("LastName").ToString) lvItem.SubItems.Add(oRD.Item("FirstName").ToString) lvItem.SubItems.Add(oRD.Item("Title").ToString) 'need to format date field aDate = oRD.GetDateTime(oRD.GetOrdinal("BirthDate")) lvItem.SubItems.Add(aDate.ToShortDateString) Call lvEmps.Items.Add(lvItem) Loop Finally oRD.Close() End Try End Sub When compile, said "MySqlConnection" not define, so oConn.Open() failed But I already imports Mysql.Data.. How to repeat: In VS 2005 express edition, repeat above code and form