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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 resultset of SQL query in vb

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-10 : 08:51:36
greg writes "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!!"

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2004-09-11 : 02:49:32
I'm not much of a VB guy, but
should you be useing "AdoQuery.Refresh" after "AdoQuery.RecordSource = SQLString" to execute the query.

and I believe the result set will be in "AdoQuery.Recordset"

just a thought..

Hemanth Gorijala
BI Architect / DBA
Go to Top of Page
   

- Advertisement -