Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datareader.read()
Message
From
21/03/2009 12:37:59
 
 
To
21/03/2009 06:05:37
Arjun Bagojikop
Dynamic Super Software
Sangli, India
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01390223
Message ID:
01390267
Views:
37
I can't see why this would be a DataReader problem, since your first MsgBox, right after you read the column data, correctly shows 12 for the first and 14 for the second. It's your second MsgBox, inside of the DoWhile loop that is apparently showing incorrect data (this is assuming that I'm correctly understanding your commented code).

So, I'm wondering if the call to updateweekoffday(offdate, lemp_code, 1) inside of your DoWhile loop is what might be affecting the the value of lemp_code. Hard to say, you haven't included the code for that method. What does that method do?

~~Bonnie



>Hi all
>in my table there are two records named field emp_unique_code -12,14
>please see the following code about datareader
>
>        Try
>            Dim dr As IDataReader = cmd.ExecuteReader
>       
>            Dim lemp_code As String
>            Dim weekoffday As Integer
>            Dim wfdt As Date = DateTimePicker1.Text
>            Dim wtdt As Date = DateTimePicker2.Text
>
>       
>            Dim offdate As Date = wfdt.Date
>            Do While dr.Read()
>                lemp_code = dr.Item("emp_unique_code")
>                weekoffday = 6 - dr.Item("week_off_day")
>               MsgBox(lemp_code)    'it shows 12 first loop  and 14 shows on secord its ok ,no pro in the second it is not working  why i dont know please help me
>                offdate = offdate.Date.AddDays(Weekday(offdate) + weekoffday - 1)
>                Do While offdate <= wtdt.Date.AddDays(1)
>                    MsgBox(lemp_code) ' in first 12 and second  12 
>                    MsgBox(offdate)
>                    updateweekoffday(offdate, lemp_code, 1)
>                    offdate = offdate.Date.AddDays(7)
>                Loop
>           
>            Loop
>
>        Catch ex As Exception
>            MsgBox(ex.Message)
>
>        End Try
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform