You're reading the next record every time you call .Read(). Simplify your
logic to this...
If myreaderwriter.Read() Then
Page2.Fontsize = 12
Page2.Textpos(xpos + (15 * dateforloop), ypos)
Page2.Writetext(myreaderwriter(0))
Else
Page2.Fontsize = 12
Page2.Textpos(xpos + (15 * dateforloop), ypos)
Page2.Writetext("0")
End If
On 9/8/05, Ali Husain <[EMAIL PROTECTED]> wrote:
>
> Hi Gurus:
>
>
>
> Correct me if I am crazy here, but in a data reader, either you can have
> it read or not read.
>
>
>
> In the code below, I stepped through it and it acts correctly when not
> reader.read.
>
> When the reader is suppose to read its skips over that but then does not
> go in to the reader.read() if block.
>
>
>
> BTW: This is part of a function that reads from the database and creates
> a PDF on the fly using a component I bought. (that's what the page2....
> Stuff is)
>
> I am guessing I am probably missing something really silly here.
>
>
>
>
>
> For dateforloop = 0 To DateDiff(DateInterval.Day,
> CDate(Request("sd")), CDate(Request("ed"))) - 1
>
>
>
> calldatetocheck = DateAdd(DateInterval.Day, dateforloop,
> CDate(Request("sd")))
>
>
>
>
>
> strConnwriter = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
>
> "Data Source=" &
> Server.MapPath("../database/DermaCareCalls.mdb;")
>
> myConnwriter = New OleDb.OleDbConnection(strConnwriter)
>
> myConnwriter.Open()
>
>
>
> mySqlwriter = "SELECT count(*) as numcalls, aAdSource from
> calllog" & _
>
> " where acalldate = #" & calldatetocheck & "#" & " and
> aAdSource = " & "'" & adsource & "'" & _
>
> " group by aadSource "
>
>
>
> myCommwriter = New OleDb.OleDbCommand(mySqlwriter,
> myConnwriter)
>
> myreaderwriter =
> myCommwriter.ExecuteReader(CommandBehavior.SingleResult)
>
>
>
> ------------ Goes in to here with no problem when the SQL Statement
> returns nothing
>
>
>
> If Not myreaderwriter.Read() Then
>
> Page2.Fontsize = 12
>
> Page2.Textpos(xpos + (15 * dateforloop), ypos)
>
> Page2.Writetext("0")
>
> End If
>
>
>
> ------------ Supposed to go in to here when the SQL Statement returns
> something
>
> The assumption is that if myreaderwriter.read doesn't NOT read that
> means it reads.
>
>
>
> If myreaderwriter.Read() Then
>
> Page2.Fontsize = 12
>
> Page2.Textpos(xpos + (15 * dateforloop), ypos)
>
> Page2.Writetext(myreaderwriter(0))
>
>
>
> End If
>
>
>
> myConnwriter.Close()
>
> myreaderwriter.Close()
>
> Next
>
>
>
> Thanks,
>
>
>
>
> Ali
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/