aspx space(??) problem

I have a aspx app. I'm trying to do the following :
sqlStatement = "SELECT fdgrp_desc  + '                               '  + fdgrp_cd as results from fd_group order by fdgrp_desc  "

The spacing seems to be ignored. I dont get it. It works perfectly in vb.net against the db.

any help by help would be appreciated
Steve
       
stephenz43Asked:
Who is Participating?
 
sunithnairConnect With a Mentor Commented:
Sorry this one i mistyped &bnsp; for  
while(sqlReader.Read())
{
  Response.Write(sqlReader[0].ToString().Replace(" ", " "));
}
 
or on VB.net
 
 
 
While sqlReader.Read()
   Response.Write(sqlReader(0).ToString().Replace(" ", " "))
End While

Open in new window

0
 
philipjonathanCommented:
Do you mean that you try to show the sqlStatement itself on the ASPX page? If you are trying to do that, the space will be truncated, that's how HTML works. But internally in the memory, the variable sqlStatement still contains as many space as you have put in there.
0
 
stephenz43Author Commented:
Im executing the sqlStatement against a data reader. The trunacation is the problem. I need those spaces .....

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
philipjonathanCommented:
Try to change each space to ' ' (without the quote)
0
 
NauticalNonsenseCommented:
If you are pulling it back like this to delineate, try something a little different.

SELECT fdgrp_cd + ',' + fdgrp_desc  as results from fd_group order by fdgrp_desc

And then when you get your result back from SQL, in your app do a little string manipulation

string[] stemp = dbr["results"].ToString().Split(",".ToCharArray(), 2);

this will give you
stemp[0]=fd_group
stemp[1]=description

If that is indeed what you are trying to do. It's very flexible this way, and the Split(x,2) makes sure to only split these into two items, so if your description has commas, you are safe.

HTH.
0
 
sunithnairCommented:
You mean when you try to show the results in the ASPX page you dont get the space displayed between those 2 colums. You will need to replace that with   to get the space working in HTML like this
while(sqlReader.Read())
{
  Response.Write(sqlReader[0].ToString().Replace(" ", "&bnsp;");
}
 
or on VB.net
 
 
 
While sqlReader.Read()
   Response.Write(sqlReader(0).ToString().Replace(" ", "&bnsp;"))
End While

Open in new window

0
 
sunithnairCommented:
Sorry one closing bracket missing in c#
while(sqlReader.Read())
{
  Response.Write(sqlReader[0].ToString().Replace(" ", "&bnsp;"));
}

Open in new window

0
 
SU-30MKICommented:
Philipjonathan is right. put ' ' in place of each space. Other wise if u take space then it will get truncated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.