I have a problem when using any SQL select statement within my code. I have this in a class.
Public Function ReadDB() As Boolean
ReadDB = False
Try
con.Open()
If con.State = ConnectionState.Open Then
da = New OleDb.OleDbDataAdapter(m_sql, con)
m_ds.Clear()
m_dv = Nothing
Try
da.FillSchema(m_ds, SchemaType.Source, m_member)
da.Fill(m_ds, m_member)
m_dv = New DataView((m_ds.Tables(m_member)))
If m_dv.Count > 0 Then
ReadDB = True
End If
Catch ex As Exception
m_errormsg = ex.Message
MsgBox(m_errormsg, MsgBoxStyle.Information)
Finally
con.Close()
End Try
End If
Catch ex As Exception
m_errormsg = ex.Message
MsgBox(m_errormsg, MsgBoxStyle.Information)
End Try
ReadDB = m_dbresult
End Function
m_ds is defined as a dataset, m_sql is the sql statement and m_member is the table name defined as a string.
The 'problem' is that the results are being held from the first select statement e.g. if I pass in Select * from TableA it retieves all cols, however if I then pass in Select col1, col2 from TableA I still get all cols returned.
Any ideas appreciated.
This post has been edited by PeterH: 30 November 2012 - 04:04 AM

New Topic/Question
Reply



MultiQuote


|