?
Solved

aspx space(??) problem

Posted on 2009-02-15
8
Medium Priority
?
680 Views
Last Modified: 2012-05-06
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
       
0
Comment
Question by:stephenz43
8 Comments
 
LVL 18

Expert Comment

by:philipjonathan
ID: 23647020
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
 

Author Comment

by:stephenz43
ID: 23647052
Im executing the sqlStatement against a data reader. The trunacation is the problem. I need those spaces .....

0
 
LVL 18

Expert Comment

by:philipjonathan
ID: 23647182
Try to change each space to ' ' (without the quote)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 7

Expert Comment

by:NauticalNonsense
ID: 23647600
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
 
LVL 16

Expert Comment

by:sunithnair
ID: 23647716
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
 
LVL 16

Expert Comment

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

Open in new window

0
 
LVL 16

Accepted Solution

by:
sunithnair earned 2000 total points
ID: 23647729
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
 
LVL 2

Expert Comment

by:SU-30MKI
ID: 23647839
Philipjonathan is right. put ' ' in place of each space. Other wise if u take space then it will get truncated.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question