inserting data into combobox problem

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 3
Joined: Mon 30 Apr 2007 05:38

inserting data into combobox problem

Post by arif_amm » Tue 01 May 2007 22:26

i try this code

Code: Select all

Imports CoreLab.MySql
Imports CoreLab.Data
Imports MySql.Data.MySqlClient
Imports System.Data

Public Class Form1
    Public conn As New MySqlConnection("User ID=root;Password=mysql;Host=;Port=3306;Database=test;pooling=true")

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Dim cmd As MySqlCommand = New MySqlCommand("select username  from muser")
            cmd.FetchAll = True
            cmd.Connection = conn
            Dim reader As MySqlDataReader = cmd.ExecuteReader()
            For Each rec As IDataRecord In reader
        Catch ex As MySqlException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Connection failed")
        End Try

    End Sub
End Class

the error apears in " For Each rec As IDataRecord In reader ".
i try this in widows application and it's work.why it does not work for pocket pc.any idea how to input data from table to combobox? thnak you..


Post by Serious » Thu 03 May 2007 09:55

You should invoke the reader.Read() method and check its return value before trying to access the MySqlDataReader data.

Post Reply