J
Jon Pope
I'm using VS.NET 2002 with VB.NET. I'm populating a datagrid with the
resultset of the following query:
strSQL = "SELECT *, ContactLastName + ', ' + ContactFirstname AS
ContactFullName " & _
"FROM Clients " & _
"ORDER BY CompanyName"
da = New SqlClient.SqlDataAdapter(strSQL, d)
ds = New DataSet()
da.Fill(ds, "Clients")
dgdClients.DataSource = ds.Tables("Clients")
I also use this same code fragment to refresh the datagrid (usually after a
time interval to insure the displayed data is current). Every so often, the
last line causes an error, and the error message claims there's no column
named "ContactFullName". Usually this occurs when I attempt to rebind the
datagrid to a new datatable as shown in the above code fragment.
Is there a "proper" way to rebind a datagrid to a new datatable? LIke I
said, this only happens occasionally.
Cheers, Jon
resultset of the following query:
strSQL = "SELECT *, ContactLastName + ', ' + ContactFirstname AS
ContactFullName " & _
"FROM Clients " & _
"ORDER BY CompanyName"
da = New SqlClient.SqlDataAdapter(strSQL, d)
ds = New DataSet()
da.Fill(ds, "Clients")
dgdClients.DataSource = ds.Tables("Clients")
I also use this same code fragment to refresh the datagrid (usually after a
time interval to insure the displayed data is current). Every so often, the
last line causes an error, and the error message claims there's no column
named "ContactFullName". Usually this occurs when I attempt to rebind the
datagrid to a new datatable as shown in the above code fragment.
Is there a "proper" way to rebind a datagrid to a new datatable? LIke I
said, this only happens occasionally.
Cheers, Jon