Question:
What code can I use to poplulate a SalesLogix Datagrid with two different sql statements?
I have a datagrid that I populate using the following code:
Dim strSQL
With Datagrid1
strSQL = “Select * from myTable”
.SQL.Text = strSQL
With .Columns
If (.Count > 0) Then
For i = 0 To .Count – 1
.Item(0).Delete
Next
End If
End With
.Refresh
End With
I want to be able to also add some records from a completely different sql string, for example,
strSQL1 = “Select * from myTable2”
and have that data also included in the datagrid. I just don’t know what the correct code is to do that? Is it .SQL.Text.Add ? or .SQL.Text.Append?
Answer:
Providing your version of Sql supports this command, you can use the Union command to join the data from both SalesLogix tables and then display it in the datagrid.
strSQL = “Select * from myTable UNION Select * from myTable2”
as long as the columns line up you are good – in other words you likely need to replace * with a list of columns.



