When trying to bind to a drop down listbox I get the above message. According to the docs. MySQLDriverCS is IDataReader compliant so shouldn't it utilise IListSource or IEnumerable ?
As you can see from the following code I want to get away from reading each record manually (the commented out code works) ...
Dim mySQLCmd As MySQLCommand = New MySQLCommand("Select ID , FullName from Service where ID > 1 order by Fullname ;", mySQLConn)
Dim mySQLData As MySQLDataReader = mySQLCmd.ExecuteReader()
' While mySQLData.Read()
' qryService.Items.Insert(0, new ListItem(mySQLData("FullName"), mySQLData("ID")))
' End While
qryService.DataSource = mySQLData
qryService.DataValueField = "id"
qryService.DataTextField = "name"
qryService.Items.Insert(0, new ListItem("Any", "0"))
mySQLData = Nothing
mySQLCmd = Nothing
I get the same message when I try databinging my DataGrid. Here's the relevant code:
dim strSQL as string = "select * from employees"
dim db_sqlCommand as new mySQLCommand(strSQL, db_MySQLConn)
dim db_sqlReader as MySQLDataReader
db_sqlReader = db_sqlCommand.executeReader()
dgEmployees.datasource = db_sqlReader
I ran into this same issue in .Net using SQL Server. To bind to a DataGrid, I had to use a DataSet rather than a SqlDataReader. Since I haven't used MySQL yet, I don't know if this software supports executeDataSet, but if it does, that's what you should use.
Big hole right here. If this driver can't execute a dataset, it's pretty much useless.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.