CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 change/modify parameter

Print topic Send  topic

Author Message
hbfaither

Posts: 15
Posted: 04/12/2004, 11:10 AM

I am Passing the following Parameters: PID,PName,ID to the following Page, MRSR_DATA_MAINT.ASP. I added custom code to the "after Initialize" function within the page.
The Function checks the "ID" Parameter (7). If it is empty,
a new record is inserted (8), this new record contains an autoincrement "ID" Field, the function retrieves the value of the tables 'ID' field (11). I then wish to change/modify the parameter "ID" to the new table "ID" field(12 + 13).
All steps seem to work except 12,13, where I attempt to copy the value of NewID to the passed Parameter 'ID'. The newid field does not contain the new table value but is always empty. I think it is in a loop, because it never finishes the compile and return a screen.

Any help will be greatly appriciated.


Function Page_AfterInitialize() 'Page_AfterInitialize @1-1E3DE16C


1. dim NewID
2. dim NewPID
3. Dim recordset
4. Dim sql

5. NewPID = request.querystring("pid")
6. NewID = request.querystring("ID")

7. if NewID = empty then
8. DBconnection1.execute "INSERT INTO MRSR_Data ( PID ) Values ("&NewPID&")"
9. sql = "select * from mrsr_data where PID = "&NewPID&" and [date_of_on-site_review] = date()"
10. set recordset = DBconnection1.execute(sql)
11. NewID = ccgetvalue(recordset,"ID")

12. Response.Redirect Request.ServerVariables("MRSR_Data_maint.asp")&"?"&_
13. AddParam(Request.ServerVariables("QueryString"),"ID",newid)
14. recordset.close
15. set recordset = nothing
16. end if


End Function 'Close Page_AfterInitialize @1-54C34B28
View profile  Send private message
hbfaither

Posts: 15
Posted: 04/12/2004, 11:13 AM

These are URL Parameters
View profile  Send private message
peterr


Posts: 5971
Posted: 04/12/2004, 12:15 PM

I recommend that you print the value of the NewID to check if it indeed is empty. For example after line 11 add:
Response.Write NewID & ":<br>"
Response.End

If it is empty then the problem is most likely on line 9 and you may also want to print the value of NewPID. You can also run the SQL manually (directly in MS Access on MS SQL) and check if it returns the ID.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
hbfaither

Posts: 15
Posted: 04/12/2004, 2:27 PM

already done That. It does return the value ID.. The problem occures during the compile and does not come out of it. it contues to loop. the url shows the ID as empty. Could it be the initial compile has an empty value for "ID" causing it to loop
View profile  Send private message
peterr


Posts: 5971
Posted: 04/12/2004, 2:32 PM

Sorry, I didn't understand the meaning of "compile". The ASP programs are never compiled. Do you mean that something is happening when the programs are being generated and published to the server?

And if the URL shows the ID as empty then when the program loops? After it gets to the new URL? In such case what is the "old" URL versus the "new" URL?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
change/modify parameter
Posted: 04/12/2004, 2:58 PM

Yes, the page is never generated and there is no error. it seems to be in some kind of loop.
History:
The url is bulit from an add/insert new record operation. the url is sending a blank/empty "ID" parameter (ID =) vice (ID = <some Number>). I wish to change
the ID from empty to some number so the new page become and update instead of an add.
hbfaither

Posts: 15
Posted: 04/12/2004, 3:05 PM

the old url can one of the two (add or Update) following:

Update:
PID = 123
property_name= "sunset plaza"
ID = 12

Add
PID = 123
property_name= "sunset plaza"
ID =
View profile  Send private message
peterr


Posts: 5971
Posted: 04/12/2004, 3:13 PM

Hi,
I was rather asking about the URL in the standard URL format, like http://localhost/page1.asp?parameter=123
Therefore can you please provide the real URL that you see in the browser (in the address bar).

Also, please replace the lines 12 & 13 with:
Response.Write Request.ServerVariables("MRSR_Data_maint.asp")&"?"&_  
AddParam(Request.ServerVariables("QueryString"),"ID",newid)  
Response.End
What do you see in result?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
hbfaither

Posts: 15
Posted: 04/12/2004, 3:32 PM

Yes...Adding "Response.end" did it. My only concern now is that I lose the other parameters. Do I have to include them as follows:
ccaddparam(request.servervariables("querystring"),"Id",newid)&_
ccaddparam(request.servervariables("querystring"),"PID",Newpid)&_
ccaddparam(request.servervariables("querystring"),"property_nam",pname)

Newid, Newpid,Pname are the result from doing request.querystring.

thank you very much for your quick response and excellent help
View profile  Send private message
hbfaither

Posts: 15
Posted: 04/12/2004, 3:55 PM

Peter, It still is not working. The page is not generating, its flashing between:
conecting to host
localhost/mrsr_data_maint.asp?Id=
View profile  Send private message
peterr


Posts: 5971
Posted: 04/12/2004, 8:24 PM

OK. Please answer my last question and I will try to help.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.