I have an sql table with two fields in it.
ex:
create_date inv_date
7/31/02 8/15/02
7/31/02 8/16/02
8/1/02 8/17/02
What my asp code does is go out and find the create_date which is equal
to today's date and then input the correlating inv_date into a stored
procedure. It kinda works but the problem is this. The code I have gets
on this never ending loop. If today was 8/1/02, it would continuously run
the stored procedure and never stop. If today was 7/31/02, it would
continualy run with one inv_date and never go to the next inv_date. One
create_date may have several inv_dates. This is an invoicing program by
the way. What I need the program to do is this:
1.find the correlating inv_date to today's date in the table
2.input the inv_date into the stored procedure
3.go back to the table and see if there are more inv_dates correlating to
today's date and run the procedure again else end
My code is as follows:
<%
on error resume next
Dim oConn, CWeb, sqlDates, sqlInvoice
Dim Errmsg, dbError
dbError = false
Dim objConn
On Error Resume Next
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "dsn="";uid="";pwd="";"
objConn.Open
Dim objRS,sqldates
Set objRS = Server.CreateObject("ADODB.Recordset")
sqlDates = "select inv_date from T250Invoice_calendar"
sqlDates = sqlDates & " where create_date = convert(char(8), getdate()) "
objrs.Open sqlDates, objConn
if err <> 0 then
dbError = true
ErrMsg = "There was a problem retrieving the information."
ErrMsg = ErrMsg & "<!-- " & err.description & " -->"
NewGoTo = "ErrorScreen.asp?ErrMsg=" & errmsg
response.redirect(NewGoTO)
else ' no err
If not objrs.EOF then
Do Until objrs.EOF
sqlInvoice = "P250Create_Invoice" & "'"& objrs
("inv_date") & "'"
err.clear
objConn.execute sqlInvoice , RecCount
if err = 0 then
else
end if
rs.MoveNext
Loop
end if
end if
objrs.close
set objrs = nothing
Set objConn = nothing
%>
Any help with the syntax would be greatly appreciated.
Thank you,
Dave