i would like to know how i could use sql queries in my VB application.
i would also like to know which query could be used to sort the values in alphabetical order.
|
Contributor
|
|
| 27Feb2007,22:36 | #2 |
|
Code:
Dim TableSource As String' Tablename from which records are takenDim SearchField As String' Field used in the "Where" clauseDim SearchString As String' Matching string used in the "Where" clauseDim SearchValue As Integer' For "Where" clause with numeric field.' (Type may be other than Integer)Dim SortField As String' Field for sorting alpahbeticallyDim SQL As String' This is where we'll put the SQL stringSQL = "Select * from [" & TableSource & "]" SQL = SQL & " Where [" & SearchField & "] Like ""*" & SearchString & "*""" SQL = SQL & " Order by [" & SortField & "]" Data1.RecordSource = SQL Data1.Refresh |
