• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 572
  • Last Modified:

MySQL connector namespace error in Visual Studio 2003

I'm totaly new to .Net but have done a course and have a book. Installed the MySQL .net Connector and have Visual Studio 2003 running on my computer.

I know I need an import statement to get the MySQL connector to work and have added the text below but just get a squiggley line underneath and a namespace not found error message.

Imports System.Data.Odbc
Imports MySql.Data.MySqlClient

Public Class WebForm2
    Inherits System.Web.UI.Page

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim myconstring = New mysqlconnection("Database=log;Data Source=192.168.0.11;User Id=root")
        Dim MyConnection As New OdbcConnection(MyConString)
        MyConnection.Open()
    End Sub

End Class



So what have I done wrong?

0
mrbryanejones
Asked:
mrbryanejones
1 Solution
 
laotzi2000Commented:
You should also add a reference to the mysql assembly in your project.
0
 
mrbryanejonesAuthor Commented:
Now I feel like a complete numpty.

That worked fine. For the record and people searching this in the future I should note there are samples in the install directory of the MySQL connector.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now