Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 Article Discussion
 using result set in an array

Author  Topic 

greg85374
Starting Member

8 Posts

Posted - 2004-07-16 : 15:30:37
Basically I created a custom calendar--it is set up the same was as microsofts calendar(active x control)

the following is all from VB6 NOT vb.net

I created a sqlstatement:
SQLString = "SELECT * FROM TblEmpAttendance WHERE Date = " & SomeDay


The valiable Someday holds all the values(from a loop) for the valid days in the current month and year!

I need to do the following:
Chk which employee(EmployeeID) the user is currently working on
Search the aforementioned table for that employee
Load the data(result set) int a textbox array in my custom calendar
My txtbox array is TxtDate(0) - TxtDate(42) but only 31 MAX are valid
I say MAx cuz there may only be a MAX of 31 days in a month

I tried(To start with):
Private Sub LoadValues()
Dim SQLString, SomeDay As String
Dim StartPoint, StopPoint, I As Integer

'Add Values to textBoxes
For I = 1 To 31 Step 1 'loop only though valid textboxes
SomeDay = MyMonth & "/" & I & "/" & CboYear.Text
SQLString = "SELECT * FROM TblEmpAttendance WHERE Date = " & SomeDay
AdoQuery.RecordSource = SQLString
TxtDate(I).Text = SQLString

Next I

End Sub


Unfortunatley I cant refer to the result AND i have NEVER tried anything like this before-I dont even know where to start!!

Any help would be highly appreciated!!!
Thanks in advance!!
   

- Advertisement -