Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Monday, March 19, 2012

Mysterious text in query result

Hi,
I have a database with a column defined as varchar(100) called Surname.
When I use Query Analyzer to retrieve data from the column and display as
text, I get strange text appearing for one of the records. Thus, the field
contains "Wilson" but when I run the following:
SELECT '''' + Surname + '''', Surnname FROM tblManagers
WHERE FirstName = 'Glenn'
I get the following result:
'Wilson d g e d w i t h t h e a ' Wilson
Where has the "d ged with the a" come from. If I show the results in a grid
the final apostrophe is missing from the first part of the query:
'Wilson
If I run a query using ADO and show the result on a web page, the extra text
is not shown.
Any ideas what is going on here?
Glenn
[Reposted, as posts from outside msnews.microsoft.com does not seem to make
it in.]
BigMan2001 (BigMan2001@.discussions.microsoft.com) writes:
> I have a database with a column defined as varchar(100) called Surname.
> When I use Query Analyzer to retrieve data from the column and display
> as text, I get strange text appearing for one of the records. Thus, the
> field contains "Wilson" but when I run the following:
> SELECT '''' + Surname + '''', Surnname FROM tblManagers
> WHERE FirstName = 'Glenn'
> I get the following result:
> 'Wilson d g e d w i t h t h e a ' Wilson
> Where has the "d ged with the a" come from. If I show the results in a
> grid the final apostrophe is missing from the first part of the query:
> 'Wilson
> If I run a query using ADO and show the result on a web page, the extra
> text is not shown.
Looks like some junk data slipped in, and there is a NUL character hiding
there. See what
SELECT convert(varbinary(100), Surname) FROM tblManagers
WHERE FisttName = 'Glenn'
returns.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.seBooks Online for SQL
Server 2005
athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000
athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Wednesday, March 7, 2012

My Table that uses aspnet foreign Keys wont display anything - CAUTION - Noob at work

I've created a new table in ASPNETDB.mdf called 'customerInfo'. Most of the fields are, for the moment, data that exists in one of the existing ASPNET tables eg Membership_UserId (primary key), Membership_Email, Users_UserName etc.; the list goes on. I have put a new column 'amountspent' - just to test that I can do what I think I can do, however the table doesn't display any data. Am I OK in thinking that I can use the aspnet data in my own tables and reference through foreign keys to them. I've made sure that the procedure that I used to put the table into a gridview on the webpage is OK as I did the same thing to the membership table and that displays all of its data. Can someone either explain the steps I need to make this happen correctly or point me in the direction of a noob type walkthrough.

Thanks

ps I've used several different ways to link the tables. First I tried building the relationships through the SqlMembershipProvider, created tables and added the foreign keys. Not sure of whether I'd done this correctly, I then used the diagram method which is pretty straightforward, however the result is the same. Surely now these tables are keyed to the UserId of aspnet_Users they should build and display a table of my existing test membership - even if the other fields, for the moment, are not carrying any data?

My store procedure returns 2 grids HELP

How do I access the 2nd grid/table in my report?
Basically I have a SP that has a SUM in one grid. The second grid
cotains the data I want to display in RS. Is there a way to get to the
2nd grid without altering the store procedure(Its being used on another
report)?
regards,
Stas K.I just found a similar topic where it says I cannot do this.
Any ideas?|||No, RS can only take a single resultset.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Sorcerdon" <sorcerdon@.gmail.com> wrote in message
news:1136923749.664965.81380@.z14g2000cwz.googlegroups.com...
> How do I access the 2nd grid/table in my report?
> Basically I have a SP that has a SUM in one grid. The second grid
> cotains the data I want to display in RS. Is there a way to get to the
> 2nd grid without altering the store procedure(Its being used on another
> report)?
> regards,
> Stas K.
>

Saturday, February 25, 2012

My report doesn't appear WYSWYG

I have a data field(text) which doesn't appear as what I see in preview. How
can I display the text with paragraphs?
I see squares between words from data I retrieved. I guess that is the
something indicates new line or new paragraph. In preview, the text is
properly displayed in different lines/paragraphs. But when I built ad
deployed it, the text becomes cramp into one paragraph. This reduce the
readability.
Appreciate if someone could give me an idea on where to set the format or
cast the data field. Thank you.Still couldn't solve my problem. Anyone can help?
More elaboration on this problem: -
When I preview I see the data field display nicely like below (eg.):
Stamp[xxx]
Subject: Server not up after rebooting
Assigned to mho3.
This has moderate impact to customer site.
--Then, after I deployed it, I browse it via IE and unfortunately I couldn't
get what I see in Preview. It gives me result like this:
Stamp[xxx] Subject: Server not up after rebooting Assigned to mho3. This has
moderate impact to customer site.
--Just imagine some have long data. It will be difficult to read.
Any help is highly appreciated. Thanks!
"sammy" wrote:
> I have a data field(text) which doesn't appear as what I see in preview. How
> can I display the text with paragraphs?
> I see squares between words from data I retrieved. I guess that is the
> something indicates new line or new paragraph. In preview, the text is
> properly displayed in different lines/paragraphs. But when I built ad
> deployed it, the text becomes cramp into one paragraph. This reduce the
> readability.
> Appreciate if someone could give me an idea on where to set the format or
> cast the data field. Thank you.
>|||Where do you get the data from? Is the new line formating something you get
by modifying fields from different columns in the database, or is it one
field that has some format in one column in your database?
Hilary Cotter suggested in a different thread that you use char(10) +
char(13) in your SQL select to get the line breaks and new lines directly
from the database. Like this:
SELECT @.a = '123' +char(10)+char(13)+ 'xyz'
I don't know why it works in preview but not on the server, though. Guess
it's the rendering format that is different. What happens when you export to
pdf on your server? Does it go all on one line or does the lines break?
Kaisa M. Lindahl Lervik
"sammy" <sammy@.discussions.microsoft.com> wrote in message
news:7D920AFA-1350-44A0-ABA9-1AA9CD71D65E@.microsoft.com...
> Still couldn't solve my problem. Anyone can help?
> More elaboration on this problem: -
> When I preview I see the data field display nicely like below (eg.):
> Stamp[xxx]
> Subject: Server not up after rebooting
> Assigned to mho3.
> This has moderate impact to customer site.
> --Then, after I deployed it, I browse it via IE and unfortunately I
> couldn't
> get what I see in Preview. It gives me result like this:
> Stamp[xxx] Subject: Server not up after rebooting Assigned to mho3. This
> has
> moderate impact to customer site.
> --Just imagine some have long data. It will be difficult to read.
> Any help is highly appreciated. Thanks!
>
>
> "sammy" wrote:
>> I have a data field(text) which doesn't appear as what I see in preview.
>> How
>> can I display the text with paragraphs?
>> I see squares between words from data I retrieved. I guess that is the
>> something indicates new line or new paragraph. In preview, the text is
>> properly displayed in different lines/paragraphs. But when I built ad
>> deployed it, the text becomes cramp into one paragraph. This reduce the
>> readability.
>> Appreciate if someone could give me an idea on where to set the format or
>> cast the data field. Thank you.|||Teng! Teng! Teng! The answer is:
=Replace(Fields!Activity_Log.Value,CHR(10),vbCrLf)
I found that those special character "squares" is represented by CHR(10) -
Line feed, from my try and error.
And in VB.NET, vbCrLf indicates new line as in "\n" for C.
Kaisa,
I got my data in a single field (not combining multiple fields), and that
field type is Text. I cast it to string so I found "squares" between words.
Before I applied the Replace function, I tried to export my report to PDF and
other format, it's just the same, no break lines. After applying the Replace
function, it works fine.
Anyway, Thks a lot for your hints, Kaisa. :-)
best regards,
sammy