开发者

How to get sets of Records in VB6?

开发者 https://www.devze.com 2023-02-23 05:07 出处:网络
Hey guys, just want to ask you a simple question that I know you\'re familiar with... I am using VB6, I just want to get sets of records from my database. What I mean is that I have UserID and with a

Hey guys, just want to ask you a simple question that I know you're familiar with... I am using VB6, I just want to get sets of records from my database. What I mean is that I have UserID and with a part of code provided below, it only gets a single set of record. Like for instance, the value of UserID is A12, and so, all sets of records with the UserID of A12 must display in Textboxes respectively with the aid of datPayroll.Recordset.MoveNext.

With datPayroll
    .RecordSource 开发者_Python百科= "select * from tblpayroll where empid like '" & UserID & "'"
    .Refresh
    Me.txtRegularHours.Text = .Recordset.Fields!reghours
End With

-datPayroll : DataControl

-txtRegularHours : Textbox

-UserID : Variable


You probably want to look at MoveFirst, MoveNext, etc. and also EOF

Here is a link or two to get you started:

EOF, BOF

MoveFirst, MoveNext

You need to check that you have some data in your Recordset using EOF, then MoveFirst to move to the first record, and loop through using MoveNext.

0

精彩评论

暂无评论...
验证码 换一张
取 消