a problem with writing code (vb.net)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply

a problem with writing code (vb.net)

Post by XYZ » Sat 11 Jun 2005 18:22

when I try to to write the example...

Dim adapter as MySqlDataAdapter
Dim cmd as MySqlCommand
Dim dataSet as DataSet
cmd.CommandText = "insert into animals (id, name) values (:id, :name); select id, name from animals where id = last_insert_id()"

I get "MySqlDataAdapter/MySqlCommand is not defined" errors.
I do have the MySql toolbox and it's working alright.
What am I doing wrong...?

thanks in advance...


Post by Serious » Tue 14 Jun 2005 07:23

The right code is

Code: Select all

Dim adapter As MySqlDataAdapter = New MySqlDataAdapter
    Dim connection As MySqlConnection = New MySqlConnection("host=server;user=root;password=root;database=test;")
    Dim commandBuilder As MySqlCommandBuilder = New MySqlCommandBuilder
    Dim command As MySqlCommand = New MySqlCommand("select * from dept", connection)
    adapter.SelectCommand = command REM set SelectCommand Property here
    commandBuilder.DataAdapter = adapter REM use command builder to generate insert, update, delete commands
    Dim ds As DataSet = New DataSet

    End Try


Post by Guest » Wed 15 Jun 2005 02:11

Thanks so much for the answer, however, the problem remains, somehow the .net still doest recognize mysqlnet elements, it's like these things are not defined or something is not included. The error shows before I even debug the project because somehow I can't get it to work with mysqlnet types.
Can it be because I've got only the standard edition?


Post by Serious » Tue 21 Jun 2005 07:10

Do you include required reference (CoreLab.MySql) to your project?


Post by Guest » Mon 27 Jun 2005 09:45

I think I did, but just incase how do you do that???


Post by Serious » Mon 27 Jun 2005 10:05

Every project node in the 'Solution Explorer' tree has a 'References' node.
Make sure that 'CoreLab.MySql' item is present there.

Post Reply