473,394 Members | 1,750 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,394 software developers and data experts.

Change _ to a +

OuTCasT
374 256MB
I got a system where a user chooses his/her course and then goes to a checkout page where the course items are in the shopping cart on the page.

Now the user needs certain criteria to be registered for the course like studentName, studentID, courseName & courseType.

anyways now when the user has entered all his information after picking his course, it first goes to a page where i load the specific criteria needed to register into session state and then it does a automatic redirect to the bank, i do this becuase no information returns when it has been processed by the bank, so if the transaction is successful it goes back to the session state page where the information is waiting there in hidden labels. ready to get posted to the student registration.

the format of the course name is Access+2003+Series, now once its come back from the bank and all the format i retrieve from session state is Access_2003_Series, now when it posts the student is not registered because it has to be posted with either the + sign or a blank space.

IS there some way on the page that i can remove the _ and change it with the + sign ????

i think it has something to do with REGULAR EXPRESSIONs.
Jan 3 '08 #1
4 1065
ck9663
2,878 Expert 2GB
can it be handled by your client-side application? i'm assuming you're talking a web-based application here and you received the data as string. can you create a client-side function/proc to replace the string you need (ie VBSCRIPT, JAVASCRIPT, etc)? if you can not and you have to pass this entire string into a stored proc and you need this string manipulation in T-SQL, there's a replace function in sql 2005, don't have time yet to test if it's in sql2K, sorry ;)

http://msdn2.microsoft.com/en-us/library/ms186862.aspx


-- CK
Jan 3 '08 #2
OuTCasT
374 256MB
can it be handled by your client-side application? i'm assuming you're talking a web-based application here and you received the data as string. can you create a client-side function/proc to replace the string you need (ie VBSCRIPT, JAVASCRIPT, etc)? if you can not and you have to pass this entire string into a stored proc and you need this string manipulation in T-SQL, there's a replace function in sql 2005, don't have time yet to test if it's in sql2K, sorry ;)

http://msdn2.microsoft.com/en-us/library/ms186862.aspx


-- CK
It is web based.
the info gets posted to that page where eventually i land on after the transaction has been successful....there i call it from session state and place it into a label on screen.
i need someway to change the _ to a + sign in order to post that data for the next step.

i tried to write a <script> so that it wld search for the _ on page load and change it too a +.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" language="javascript">
  2.     function Replace(str)
  3.     {
  4.            return str.replace(/\_/g, "+");
  5.     }
  6.     </script>
but that doesnt work.
Jan 4 '08 #3
ck9663
2,878 Expert 2GB
if you're going to handle this in front-end, it's becoming a scripting problem, not sql-server.

do you need the _ be repalce to + before it goes to db? coz if inside the db and before you store in in the table you can use the replace function

-- CK
Jan 4 '08 #4
OuTCasT
374 256MB
if you're going to handle this in front-end, it's becoming a scripting problem, not sql-server.

do you need the _ be repalce to + before it goes to db? coz if inside the db and before you store in in the table you can use the replace function

-- CK

i worked it out hehe,

the problem was on the checkout page....the querystring was already being changed from + to _ so i revered that ...

Expand|Select|Wrap|Line Numbers
  1. function QueryString(param){
  2.             var loca = document.location.href;
  3.             if(loca.indexOf('?'   param   '=')>-1 || loca.indexOf('&'   param   '=')>-1){
  4.                 var qString = loca.split('?');
  5.                 var keyVal = qString[1].split('&');
  6.                 for(var i=0;i<keyVal.length;i  ){
  7.                     if(keyVal[i].indexOf(param   '=')==0){
  8.                         var val = keyVal[i].split('=');
  9.                         return val[1];
  10.                     }
  11.                 }
  12.                 return false;
  13.             }else{
  14.                 return false;
  15.             }
  16.         }
  17.  
  18.         function Trim(str){
  19.            return str.replace(/[\(\)\.\-\s,]/g, "");
  20.         }
  21.         function Trim2(str){
  22.            return str.replace(/[\(\)\R\-\s,]/g, "");
  23.         }
  24.  
  25.        function Replace(str){
  26.            return str.replace(/\_/g, "+");
  27.         }
  28.        function Replace2(str){
  29.            return str.replace(/\%26/g, "and");
  30.         }
  31.  
  32.         function moneyFormat(input) {
  33.            var dollars = Math.floor(input);
  34.            var tmp = new String(input);
  35.  
  36.            for ( var decimalAt = 0; decimalAt < tmp.length; decimalAt   ) {
  37.               if ( tmp.charAt(decimalAt)=="." )
  38.                  break;
  39.            }
  40.  
  41.            var cents  = ""   Math.round(input * 100);
  42.            cents = cents.substring(cents.length-2, cents.length)
  43.                    dollars  = ((tmp.charAt(decimalAt 2)=="9")&&(cents==""))? 1 : 0;
  44.  
  45.            if ( cents == "0" )
  46.               cents = "00";
  47.  
  48.            return(dollars   "."   cents);
  49.         }
  50.  
  51.  
  52.     </script>
Jan 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: J.C. Flores | last post by:
Hello all, First of all, I must state that I'm new to SQL Server, but have been a long-time software guy for quite some time. Please excuse the potential simplicity of the solution to my...
1
by: Spike | last post by:
Hello! Im going to make a javascript for changing alot of images. But im not sure how to do it., where to start.. Ok, first.. this is the isue. I have 3 images(I call them 1a-3a). when u...
0
by: beanweed | last post by:
BACKGROUND ---------- I have an ASP.NET application having two panels. In one panel, an XML document, transformed using xsl, is displayed. In the other panel are some controls that allow a user...
5
by: Hank | last post by:
My Access 2000 code has been running for several years in our main plant. Now we need to install it, as a stand-along application, at remote sites, some of which are out of state. My problem is...
10
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
4
by: active | last post by:
It appears to me that if I change the Control's client size the controls size does not change to agree with the new size. Does it work like the VB6 ScaleWidth and ScaleHeight? That is after I...
3
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change...
2
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? ...
11
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
1
by: monkey1001 | last post by:
my program is suppose to show my due change and i got it working but my change and coins are wrong how can i improve it thank you..(its supposed to be in java)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.