|
|
Title | Display query results in a bound grid control |
Description | |
Keywords | database, bound controls, grid |
Categories | Database |
|
|
By Marlon Durana.
When you enter a query into the ComboBox and click the Query button, the program sets the RecordSource property of a Data control to the query and calls its Refresh method. The program also adds the query to the ComboBox's list of choices so you can select the query later. (It would be better if it checked whether the query was already in the list first).
|
|
Private Sub Command1_Click()
Dim i As Integer
On Error GoTo ErrorHandler
With Data1
.RecordSource = Trim$(Text1.Text)
.Refresh
End With
Text1.AddItem Text1.Text
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & " -->" & _
Err.Description & ".", vbCritical, "Query Error"
End Sub
|
|
For information on database programming in VB .NET, see my book
Visual Basic .NET Database Programming.
|
|
|
|
|
|