no or else i wouldn't be asking, the new code, is as follows:
sourceData = New DatabaseConnection
Dim dataSet As New DataSet
Try
' Get all clients in a DataReader object
sourceData.SQL = "qryClientName"
sourceData.InitialiseCommand()
sourceData.OpenConnection()
sourceData.DataReader = sourceData.Command.ExecuteReader
sourceData.FillDataSet(dataSet, "qryClientName")
' check data exists
If sourceData.DataReader.HasRows Then
' process all rows
'While sourceData.DataReader.Read()
'cboClient.Items.Add(sourceData.DataReader.Item("C liName"))
cboClient.DataSource = sourceData.DataReader
cboClient.DisplayMember = sourceData.DataReader.GetInt16(0)
cboClient.ValueMember = sourceData.DataReader.GetString(1)
'cboClient.DataBindings(dataSet)
'End While
End If
'sourceData.DataAdapter.Dispose()
Catch ExceptionErr As Exception
MessageBox.Show(ExceptionErr.Message)
Finally
' cleanup
sourceData.Dispose()
sourceData = Nothing
'dataSet.Dispose()
'dataSet = Nothing
End Try
but this is telling me that the connection its using is open, and therefore not available to use. I'm really struggling with how to do this.
thanks
Amethyst
|