473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Empty parameters in a asp .net (vb) page query string

Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect,
the first one is ok ok and gets populated by the other two get inserted into
the url for the redirect as empty strings! Anyone got any clues?? The code
is below and I have checked that the variables beginning with "g_str" are
all populated before the code is called. I think its something to do with
the "&" in the "&Title" and "&Version", do I need to do something to
those???

Cheers
Paul

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redirect("http://localhost/misc/frmEntry.aspx?Error=" & strVal_1 &
strVal_2 & strVal_3)
Jul 20 '05 #1
2 3104
Paul...I'm not sure but when you step through it in the debugger, I'm
assuming all the assignement are done correctl ( ie strVal_1, strVal_2 and
strVal3)

Try this...

Dim sb as New System.Text.Stringbuilder
sb.Append("http://localhost/misc/frmEntry.aspx?Error=")
sb.Append("?SQL=" & strSQL)
sb.Append("&Title=" & g_strTitle)
sb.Append("&Version=" & g_strVersion)
'Put breakpoint here to make sure redirect is what you want in it's
entirety - in the command window ?sb.ToSTring

Response.Redirect(sb.ToSTring)

It looks like the + might be the cause of improper string concatenation. In
either case, even if you don't use a stringbuilder, just add on all
concatenations with the line continue character _ b/c as it stands now,
you're creating at a minimum 3 string objects when one would do. (This
isn't the problem you are referring to, but it's just a suggestion for
efficiency's sake.)

Let me know if the full query string is getting populated correctly and if
so, we'll try to narrow it down from there.

Good Luck,

Bill

"Paul M." <pa**@nospam.fsnet.co.uk> wrote in message
news:bi**********@news6.svr.pol.co.uk...
Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect,
the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings! Anyone got any clues?? The code
is below and I have checked that the variables beginning with "g_str" are
all populated before the code is called. I think its something to do with
the "&" in the "&Title" and "&Version", do I need to do something to
those???

Cheers
Paul

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redirect("http://localhost/misc/frmEntry.aspx?Error=" & strVal_1 & strVal_2 & strVal_3)

Jul 20 '05 #2
You probably need to URLEncode the variables.

You can look that up in the help system.

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:uU*************@TK2MSFTNGP12.phx.gbl...
Paul...I'm not sure but when you step through it in the debugger, I'm
assuming all the assignement are done correctl ( ie strVal_1, strVal_2 and
strVal3)

Try this...

Dim sb as New System.Text.Stringbuilder
sb.Append("http://localhost/misc/frmEntry.aspx?Error=")
sb.Append("?SQL=" & strSQL)
sb.Append("&Title=" & g_strTitle)
sb.Append("&Version=" & g_strVersion)
'Put breakpoint here to make sure redirect is what you want in it's
entirety - in the command window ?sb.ToSTring

Response.Redirect(sb.ToSTring)

It looks like the + might be the cause of improper string concatenation. In either case, even if you don't use a stringbuilder, just add on all
concatenations with the line continue character _ b/c as it stands now,
you're creating at a minimum 3 string objects when one would do. (This
isn't the problem you are referring to, but it's just a suggestion for
efficiency's sake.)

Let me know if the full query string is getting populated correctly and if
so, we'll try to narrow it down from there.

Good Luck,

Bill

"Paul M." <pa**@nospam.fsnet.co.uk> wrote in message
news:bi**********@news6.svr.pol.co.uk...
Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect, the first one is ok ok and gets populated by the other two get inserted into
the url for the redirect as empty strings! Anyone got any clues?? The code is below and I have checked that the variables beginning with "g_str" are all populated before the code is called. I think its something to do with the "&" in the "&Title" and "&Version", do I need to do something to
those???

Cheers
Paul

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redirect("http://localhost/misc/frmEntry.aspx?Error=" &

strVal_1 &
strVal_2 & strVal_3)


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul M. | last post by:
Hi, I am trying to populate 3 paramters in an asp .net (vb) page redirect, the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings!...
11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
10
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual...
0
by: jennifer.perkins | last post by:
I've seen a couple posts by people having similar problems, but the suggested solutions I've tried so far haven't worked. I'm using a SOAP client in VB.Net (constructed by wsdl.exe) and the...
3
by: eagleofjade | last post by:
I am trying to help a friend who is learning VB.net in school. I have done VB programming for a number of years using VB 6. He needs to open a query in an Access database that has parameters so he...
7
by: Aaron Gray | last post by:
I put together the following code to get the href's parameters :- function GetParameters() { var arg = new Object(); var href = document.location.href; if ( href.indexOf( "?") != -1) { var...
8
by: yawnmoth | last post by:
Say I have the following HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <form action="">
3
by: Haleigh | last post by:
I just started a few days ago, so I'm very new to this. I'm trying to update a gridview using a store procedure. When I am in the update subroutine, newvalues and oldvalues are empty, plus count is...
4
by: ipez75 | last post by:
Hello everyone, I have a web application written in asp 6.0, my problem is that I execute a sql server store procedure and I get an empty recordset, while executing the same sp on query anlyzer I...
4
kcdoell
by: kcdoell | last post by:
Hello: What is the best way to stop a report from running if the query is empty? Currently, I have a form that has a command button on it. The user has to make selections from 3 combo boxes on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.