Greetings and salutations!
A simple way to start could be to set up an ODBC, DAO, or ADO connnection to your SQL Server database, assuming you already have a database built with fields needed, say the field to search is called ID, on your VB6 form, you would have a textbox searching just that field (ID), here's an example using DAO, you'll need to add Microsoft DAO 3.6 Library. It search:
-
-
'this is searching for existing data in your database
-
Private Sub seek_Click() ' your search button
-
Dim my_database As Database 'dimension database as database so program knows where to look for data
-
Dim my_record As Recordset
-
Dim test As String
-
test = Text1(1).Text
-
Set my_database = OpenDatabase("K:\Projects\DBMOVIE.mdf")
-
Set my_record = my_database.OpenRecordset("select * from Movie_Data_Table where movie_title like '" & Text1(1).Text & "'") ' this is used to search by name, only if data already exists
-
Do While Not my_record.EOF 'this function will keep searching for fields matching each textbox
-
Text1(0).Text = my_record.Fields("UserID")
-
Text1(1).Text = my_record.Fields("movie_title")
-
Text1(2).Text = my_record.Fields("movie_type")
-
Text1(3).Text = my_record.Fields("rating_scale")
-
Text1(4).Text = my_record.Fields("movie_location")
-
Text1(5).Text = my_record.Fields("movie_format")
-
my_record.MoveNext
-
Loop
-
my_database.Close
-
End Sub
-
Hope this help steer it in the right direction for you...