Kerry, I'm sorry but your code didn't work.
Here's the error message:
Message: No value given for one or more required parameters.
System.Data.Oledb.OLEdbException
Source: Micrsoft Jet Database Engine at
System.Data.OledbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object&ExecuteResult)
.....
at System.data.common.dbdataadater.fillInternal(DataSet dataset, DataTable
datatables, int32StartRecord,\Int32 MaxRecords....
at system.data.common.dbdataadapter.fill(datatable datatable)
line 404
dAdapter.Fill(dTable)
Here's the code I adapted from you:
Dim cnstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=|DataDirectory|\HasbaraSample.mdb;Persist Security Info=True"
Dim cn As New OleDbConnection(cnstring)
Dim cmd As New OleDb.OleDbCommand
Dim dAdapter As New OleDb.OleDbDataAdapter
Dim dTable As New DataTable
cmd.CommandText = "Select LastName + ', ' + FirstName As
AuthorName, ID From Authors2 Order By AuthorName"
cnAC.Open()
cmd.Connection = cn
dAdapter.SelectCommand = cmd
Me.lstAuthors.DisplayMember = "AuthorName"
lstAuthors.ValueMember = "ID"
lstAuthors.DataSource = dTable
dAdapter.Fill(dTable)
cn.Close()
If the lstAuthors statements are placed after the cn.close, I get the same
error.
dennist685