If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Newbie Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-07, 18:47
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
Newbie Question

Hello all...I have a question about ASP and VBScript. I have an ASP page that has some VBScript in it. There is a field on the form called frmreports.reportstring and there is a value assoicated with it. I m trying for that value in my server asp code to run a stored procedure. Is there a way to do it because as soon as there is a <% the variable goes blank and I cant seem to be able to move anything beyond <%.


Please help!!
Reply With Quote
  #2 (permalink)  
Old 04-22-07, 18:50
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
let me show you the code...right after the first line is where I m trying to get the value for frmReports.reportString.value but as soon as I put the <% I cant get anything.
Code:
       window.open(frmReports.reportString.value & bu & "&beginDate=" & frmReports.txtBeginDate.value & "&endDate=" & frmReports.txtEndDate.value & "&singleDate=" & frmReports.txtSingleDate.value & "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week)	
<%

	dim reportString
	dim strQueryString
	dim strQueryString1
	dim strURL
	dim reportid1
	dim reportid2
	
	reportString = frmReports.reportString.value
	strQueryString = Instr(reportString,"rnum=") '25
	reportid1 = mid(reportString,strQueryString+5,3) 
		
	msgbox frmReports.reportString.value, 48, "Show me the reportid1"	
	msgbox reportString, 48, "show me reportstring"
	msgbox strQueryString, 48, "Show me StrQueryString"
	msgbox reportid1, 48, "show me reportid"
		

	'dim strQueryString
	'dim strQueryString1
	'dim strURL
	'dim reportid1
	'dim reportid2
	 
	
	'strURL = frmReports.reportString.value
	'strQueryString = mid(strURL, Instr(1, strURL,"rnum")+3)
	'strQueryString = Instr(strURL,"rnum=") '25
	'strQueryString1 = Instr(strURL,"&db") '27
	'reportid1 = mid(strURL,strQueryString+5,3) 
	'reportid2 = CInt(reportid1)
	'document.write(reportid1)
	'window.open(document.write(reportid1))
	

	

		
	'	ReportID1=rs(ReportID)
		
		dim cmdform
		
		set cmdform=CreateObject("ADODB.Command")
			with cmdform
				.ActiveConnection=mainconnection
				.Commandtype=4
				.CommandText="SP_REPORT_INCREMENT"
				.parameters.append .createparameter("@ReportID",200,1,5,reportid1)
				.parameters.append .createparameter("@strURL",200,1,80,reportString)
				.parameters.append .createparameter("@strQueryString",200,1,80,strQueryString)
				.parameters.append .createparameter("@strQueryString1",200,1,80,strQueryString1)
				.Execute ,,128
			End with
			Set cmdform=nothing
	%>
Reply With Quote
  #3 (permalink)  
Old 04-23-07, 02:16
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Take a look at request.form and request.querystring at www.w3schools.com
__________________
George
Twitter | Blog
Reply With Quote
  #4 (permalink)  
Old 04-23-07, 06:39
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
I did use Request.QueryString but it didnt return anyhting for some reason....I will try and see if Request.Form does anything...Thanks
Reply With Quote
  #5 (permalink)  
Old 04-23-07, 06:41
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Code:
window.open(frmReports.reportString.value & bu & "&beginDate=" & frmReports.txtBeginDate.value & "&endDate=" & frmReports.txtEndDate.value & "&singleDate=" & frmReports.txtSingleDate.value & "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week)
What does this line do exactly?
__________________
George
Twitter | Blog
Reply With Quote
  #6 (permalink)  
Old 04-23-07, 07:43
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
Quote:
Originally Posted by georgev
Code:
window.open(frmReports.reportString.value & bu & "&beginDate=" & frmReports.txtBeginDate.value & "&endDate=" & frmReports.txtEndDate.value & "&singleDate=" & frmReports.txtSingleDate.value & "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week)
What does this line do exactly?
This is the line that opens the report and that is where I m trying to increment 1 everytime a report is run since we are using a table in SQL Server 2000 for Reports and each report has its reportid. frmReports.ReportString.value is being populate with the values up in the script with all the variables that I want to use....another thing I want to mention is since the report id is no where on the form how am I suppose to use Request.Form?
Reply With Quote
  #7 (permalink)  
Old 04-23-07, 07:49
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
That was going to be my followup - I realised that you probably wern't using a form collection for this, so the request.form wouldn't work.

I have never used a window.open command, so could you explain what all the "junk" between the parens is?
__________________
George
Twitter | Blog
Reply With Quote
  #8 (permalink)  
Old 04-23-07, 08:03
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
Quote:
Originally Posted by georgev
That was going to be my followup - I realised that you probably wern't using a form collection for this, so the request.form wouldn't work.

I have never used a window.open command, so could you explain what all the "junk" between the parens is?

frmreports.reportString.Value is being populated with:

response.write("frmReports.reportString.value=""" & rs("strReportURL") & "&tButton="& rs("strtButton") & "&rFile1="& rs("ReportGroup") & "&rnum=" & rs("ReportID") & """" & vbcrlf)

and reportID is what I m looking for in there but since there are quite a few scripts between here and where the frmReports.reportString.value is populated scope of the variable has been expired.

then there are some dates that are being entered on the form itself. There are some single dates that are only for the week and then there are dates that have start and end date. That is whats in the window open command....



frmReports.reportString.value Variable that has all the values I m looking for....
bu = business unit
beginDate=" & frmReports.txtBeginDate.value ---beginning date from the form
& "&endDate=" & frmReports.txtEndDate.value & ---end date from the form
"&singleDate=" & frmReports.txtSingleDate.value ---one date only from the form if the report is for a running week
& "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week --week based if there is only one date

Last edited by us1415; 04-23-07 at 08:07.
Reply With Quote
  #9 (permalink)  
Old 04-23-07, 08:09
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Quote:
and reportID is what I m looking for in there but since there are quite a few scripts between here and where the frmReports.reportString.value is populated scope of the variable has been expired.
So would it be worth creating another variable earlier on and store the value in there? I'm assuming that you are closing the recordset which is why you cannot pick up the required value.
Code:
Dim SomeVariable
<open RS>
SomeVariable = RS("ReportID")
In theory, you should not be assigning all the values you need from the RS into variables so you can close the RS asap.
__________________
George
Twitter | Blog
Reply With Quote
  #10 (permalink)  
Old 04-23-07, 08:15
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
Quote:
Originally Posted by georgev
So would it be worth creating another variable earlier on and store the value in there? I'm assuming that you are closing the recordset which is why you cannot pick up the required value.
Code:
Dim SomeVariable
<open RS>
SomeVariable = RS("ReportID")
In theory, you should not be assigning all the values you need from the RS into variables so you can close the RS asap.
That is true...would it close the RS even if I have some code that is closing the RS or should I remove the closing of RS from there altogether?
Reply With Quote
  #11 (permalink)  
Old 04-23-07, 08:18
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I don't think I follow.
Here's what I would be doing
Code:
<open RS>
varBeginDate = RS("beginDate")
varReportID = RS("ReportID")
<close RS>
window.open( ... )
__________________
George
Twitter | Blog
Reply With Quote
  #12 (permalink)  
Old 04-23-07, 09:43
us1415 us1415 is offline
Registered User
 
Join Date: Mar 2006
Posts: 7
I found a way around it...I m doing another window.open and pasrsing the variabe to another program that does the increment...Thanks for the suggestions though.....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On