Kerry,
I had a good look through the thread and came up with this funcction
Public Function SelectRows(ByVal dataSet As DataSet, ByVal queryString As
String) As DataSet
Dim adapter As New SqlClient.SqlDataAdapter
adapter.SelectCommand = New SqlClient.SqlCommand(queryString,
CON_BOSSCONNECTION)
adapter.Fill(dataSet)
Return dataSet
End Function
however it blows out at adapter.Fill(dataSet) with the following error
An unhandled exception of type 'System.ArgumentNullException' occurred in
system.data.dll
Additional information: Value cannot be null.
im calling it by using the following
dim REUSE_DATASET As DataSet
SelectRows(REUSE_DATASET, STR_SQLQuery)
this is all new to me and im totally confused now
"Kerry Moorman" wrote:
Peter,
You need to look into the DataAdapter, DataSet and DataTable classes.
Use a dataadapter to fill a dataset's datatable with the results of your sql
select query.
Then assign the dataset's datatable to the datagrid's DataSource property.
Kerry Moorman
"Peter Newman" wrote:
Im just toying with vb.net and am trying to find out howw things work. i
have managed to come up with the following code that will access a table in a
sql2005 server . what id like to do is populate 'DataGrid1' with the results
can anybody explain how this is done
STR_SQLQuery = "select LICENCE, COMPANYNAME from
DevSys.dbo.clientAdmin "
STR_SQLCOMMAND.CommandText = STR_SQLQuery
STR_SQLCOMMAND.Connection = CON_BOSSCONNECTION
STR_SQLREADER = STR_SQLCOMMAND.ExecuteReader
Try
While STR_SQLREADER.Read()
Console.WriteLine(STR_SQLREADER.GetString(0) & " " &
STR_SQLREADER.GetString(1))
End While
Finally
STR_SQLREADER.Close()
End Try