inserting data into combobox problem
Posted: Tue 01 May 2007 22:26
i try this code
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..
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=192.168.0.5;Port=3306;Database=test;pooling=true")
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
conn.Open()
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
combobox1.Items.Add(rec("username"))
Next
reader.Close()
conn.Close()
Catch ex As MySqlException
MsgBox(ex.Message, MsgBoxStyle.Critical, "Connection failed")
End Try
End Sub
End Class
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..