Showing posts with label displaying. Show all posts
Showing posts with label displaying. Show all posts

Friday, March 30, 2012

problem with line break from NVARCHAR field

I have data saved in nvarchar field in SQL Server and I am displaying it using <= dbReader["my_field"] but even the three or four paragraphs comes as one paragragh and I don't know know where are my line breaks going?

In SQL Server if you want line breaks and well formatted text you must save your text as word in an image column so you can just get the word file back. There could be other ways but this is easy so I use it you could get other answers. Hope this helps.

|||

but this will kill the database size!!

in ASP 3.0 I was doing the following so what is the simillar command in .NET?

<%= Replace(rs("full_story"), vbCrlf, "<br>") %>

|||You were using that against Access or SQL Server?|||SQL Server|||

I found three solutions all long but may do what you want but not with one line of code. Hope this helps.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2003_ta/html/odc_VSTWrdSql.asp

http://codebetter.com/blogs/john.papa/archive/2005/08/09/130476.aspx

http://www.informit.com/guides/content.asp?g=sqlserver&seqNum=151&rl=1

sql

Wednesday, March 21, 2012

Problem with Grid View

i seem to have problems with my grid view not displaying anything when if i test my SQLDataSource, it shows me rows of data.

i seem to have this problem only with my Stored procedure, or when i change my Database structure, like add fields

Here is my procedure: can i do this? select a row and also return a varchar?

ALTER PROCEDURE dbo.SelectUpload(@.FileNamevarchar(50),@.Return varchar(MAX) =NULLOUTPUT)ASSELECT *FROM UploadsWHERE FileName = @.FileNameRETURNSELECT WebPathFROM UploadsWHERE FileName = @.FileName

Assuming that Webpath is a column in Uploads, why do you need the two select statements? When you do Select * from Uploads, Webpath will part of the dataset that the sqldatasource returns. Why can't you do:

ALTER PROCEDURE dbo.SelectUpload

@.FileNamevarchar(50)

AS
SELECT *FROM Uploads
WHERE FileName = @.FileName
RETURN

|||

i was thinking of returning a table to display in a Grid View, and also a Web Path (eg. "~/Images/image.jpg") to be displayed as a image, something like that. so that i don't have to retrieve it from the Data Source or Grid View.

|||

I still think you can grab all the data you need using one select statement and then do what you need to do with the data:

For the data you want displayed in the gridview:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="value1" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="value1" HeaderText="value1" ReadOnly="True" SortExpression="Value1" />
<asp:BoundField DataField="value2" HeaderText="value2" SortExpression="value2" />
<asp:BoundField DataField="value3" HeaderText="value3" SortExpression="value3" />
</Columns>
</asp:GridView>

For the webpath (lets say you want to display in a label):

Dim dv As DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)
Dim dr As DataRow
dr = dv.Table.Rows(0)
lblWebPath.Text = dr("WebPath").ToString()

Wednesday, March 7, 2012

Problem with displaying workflow?

Hi,

I just recognized a strange displaying problem in one of my SSIS jobs.

I created job which contains a sequence container. Within the sequence container there is one "Execute SQL Task" and one "Foreach Loop Container". Within the "Foreach Loop Container" there are 4 task which are connected with precedence constraints.

Now my problem is that if I load the SSIS job and open the "sequence container" while the "Foreach Loop Container" is already open then the precedence constraint won't be displayed. If I close and open the "Foreach loop container" again then the precedence constraints will be displayed again.

My first assumption was that it might be a problem with the display drivers of the computer ....however the problem appears also on any other computer.

Does anyone know how to solve this display problem without closeing/reopening the container?

Thanks,

StSt

StSt,

You just have to lump it I'm afraid. It happens from time to time.

-Jamie

Problem with displaying image on the report

I have a webservice which creates an image returns that image in the form of Byte array. I want to consume this webservice and display that image on my report. When I see my report in the Preview tab of the report designer, it displays that image but when I deploy my report on the report server, image doesn't show up. I have copied app_code.dll (dll for the webservice) to the following locations:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin

Here is the code for the webservice:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Drawing
Imports System.Diagnostics
Imports System.IO

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Public Class Service
Inherits System.Web.Services.WebService

<WebMethod()> _

Public Function HelloWorld() As Byte()

Dim marker As New Bitmap("C:\Inetpub\wwwroot\help.gif")
Dim imageStream As New System.IO.MemoryStream
marker.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg)
Trace.Write("Before Write")
Return imageStream.ToArray()

End Function

End Class

I have referenced this dll saved in public assemblies folder from my report project and wrote a function to call the above mentioned webservice function HelloWorld() and called the function from value property of an image control on the report.

Does anybody has any idea what am I missing?

Thanks

Its probably an authentication problem. Try configuring an Unattended Execution Account for SRS to an account which has permission to access the web service on the remote machine. Also check the IIS logs on the machine serving the image for failed login attempts.

Problem with displaying image from DB

I am able to write an image to a SQL table. The problem I am having is understanding how to retrieve the image from the table AND display it on a page along with the other page content.

Does anyone have an example or an article to help me with this procedure? I have searched the discussion and read a few articles but they all talk about reading an image into a datagrid which isn't what I want.

Dazed & confused!!!If you can display the image in a datagrid, you can display it by itself too.

Try looking at:
http://authors.aspalliance.com/das/readimage.aspx

That has some code (VB.NET) to show images from a SQL database.

I would recommend reading the other articles linked to that page as well.

You'll probably find that datagrid image code you've already seen will have a hint to the answer.|||I think thats the original page where I got the code to write the image to a database.

As you can see from the link, when they retrieve the image, they either retrieve it in a datagarid or on a page by itself.

It must be a lot harder to pull it into a page with existing data than I can figure out. My hands are tied. All examples are limited to either datagrid examples or a page with only the image and nothing else...ugghhhh!

Problem with display of International characters

Hi All,
I have a problem in displaying International characters in SQL Server 2000.
There are a few Russian characters that are displayed as '?' in query
analyzer. i have the database setup on 2 machines. On one DB server the
characters are displayed properly and on other it is shown as '?'.
The machine on which '?' are displayed, i queried syslanguages in which
'Traditional Chinese' and 'Thai' months are displayed incorrectly like small
squares.
Please let me know if there is any SQL server setting required to be changed
or it is some setup issue.
I have also checked 'Ansi to oem conversion' settings.
Thanks
Regards
Sudesh.
This is not a SQL Server problem. Try installing the supplemental language
support files.
1. From Control Panel, select Regional and Language Options
2. From the Languages tab, select the check boxes under Supplement Language
Support.
That should resolve your problem.
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Sudesh" <sudesh.h@.polaris.co.in> wrote in message
news:4A4B2435-1E31-4E6A-92BA-835D87E68B13@.microsoft.com...
> Hi All,
> I have a problem in displaying International characters in SQL Server
> 2000.
> There are a few Russian characters that are displayed as '?' in query
> analyzer. i have the database setup on 2 machines. On one DB server the
> characters are displayed properly and on other it is shown as '?'.
> The machine on which '?' are displayed, i queried syslanguages in which
> 'Traditional Chinese' and 'Thai' months are displayed incorrectly like
> small
> squares.
> Please let me know if there is any SQL server setting required to be
> changed
> or it is some setup issue.
> I have also checked 'Ansi to oem conversion' settings.
> --
> Thanks
> Regards
> Sudesh.

problem with Display databound images in page header

Hi all,
I have a problem in displaying databound images in page header.
I have done as is stated in the below article.
-X-
http://msdn2.microsoft.com/en-us/library/ms159677(en-us,VS.90).aspx
Adding a Databound Image to a Header or Footer
You can use image data stored in a database in a header or footer. However, you cannot reference database fields from the Image control directly. Instead, you must add a text box in the body of the report and then set the text box to the data field that contains the image (note that the value must be base64 encoded). You can hide the text box in the body of the report to avoid showing the base64 encoded image. Then, you can reference the value of the hidden text box from the Image control in the page header or footer.
For example, suppose you have a report that consists of product information pages. In the header of each page, you want to display a photograph of the product. To print a stored image in the report header, define a hidden text box named TXT_Photo in the body of the report that retrieves the image from the database and use an expression to give it a value:
=System.Convert.ToBase64String(Fields!Photo.Value)
In the header, add an Image control which uses the TXT_Photo text box, decoded to show the image:
=System.Convert.FromBase64String(ReportItems!TXT_Photo.Value)

-X-
but I am not getting the image.
The error message displayed is like this
[rsInvalidExpressionDataType] The Value expression used in image ‘image2’ returned a data type that is not valid.
Can any one help me in this regard.
Thanks in advance.
Ramesh

What's the image source type of the image reportitem? Is it set to "Database"?

-- Robert

|||

If the image was saved to the database via MS Access, the solution is here: http://forums.devarticles.com/microsoft-sql-server-5/displaying-image-fields-in-reporting-services-11844.html . In brief, as it states, instead of utilizing the hidden text box and Base64 strings, simply use this piece of code to set the Value property of your RS image control:

=System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))

For English use XXX = 79
For Spanish use XXX = 89

(The image control should still have its Source property set to Database.)

|||

u can do that with the help of parameters

1) add a calculated field in dataset named imagebase64 in that add the following expression

Convert.ToBase64String(Fields!Photo.value)

2)Add report Parameter named image

set the datatype as string.

problem with Display databound images in page header

Hi all,
I have a problem in displaying databound images in page header.
I have done as is stated in the below article.
-X-
http://msdn2.microsoft.com/en-us/library/ms159677(en-us,VS.90).aspx
Adding a Databound Image to a Header or Footer
You can use image data stored in a database in a header or footer. However, you cannot reference database fields from the Image control directly. Instead, you must add a text box in the body of the report and then set the text box to the data field that contains the image (note that the value must be base64 encoded). You can hide the text box in the body of the report to avoid showing the base64 encoded image. Then, you can reference the value of the hidden text box from the Image control in the page header or footer.
For example, suppose you have a report that consists of product information pages. In the header of each page, you want to display a photograph of the product. To print a stored image in the report header, define a hidden text box named TXT_Photo in the body of the report that retrieves the image from the database and use an expression to give it a value:
=System.Convert.ToBase64String(Fields!Photo.Value)
In the header, add an Image control which uses the TXT_Photo text box, decoded to show the image:
=System.Convert.FromBase64String(ReportItems!TXT_Photo.Value)

-X-
but I am not getting the image.
The error message displayed is like this
[rsInvalidExpressionDataType] The Value expression used in image ‘image2’ returned a data type that is not valid.
Can any one help me in this regard.
Thanks in advance.
Ramesh

What's the image source type of the image reportitem? Is it set to "Database"?

-- Robert

|||

If the image was saved to the database via MS Access, the solution is here: http://forums.devarticles.com/microsoft-sql-server-5/displaying-image-fields-in-reporting-services-11844.html . In brief, as it states, instead of utilizing the hidden text box and Base64 strings, simply use this piece of code to set the Value property of your RS image control:

=System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))

For English use XXX = 79
For Spanish use XXX = 89

(The image control should still have its Source property set to Database.)

|||

u can do that with the help of parameters

1) add a calculated field in dataset named imagebase64 in that add the following expression

Convert.ToBase64String(Fields!Photo.value)

2)Add report Parameter named image

set the datatype as string.

problem with Display databound images in page header

Hi all,
I have a problem in displaying databound images in page header.
I have done as is stated in the below article.
-X-
http://msdn2.microsoft.com/en-us/library/ms159677(en-us,VS.90).aspx
Adding a Databound Image to a Header or Footer
You can use image data stored in a database in a header or footer. However, you cannot reference database fields from the Image control directly. Instead, you must add a text box in the body of the report and then set the text box to the data field that contains the image (note that the value must be base64 encoded). You can hide the text box in the body of the report to avoid showing the base64 encoded image. Then, you can reference the value of the hidden text box from the Image control in the page header or footer.
For example, suppose you have a report that consists of product information pages. In the header of each page, you want to display a photograph of the product. To print a stored image in the report header, define a hidden text box named TXT_Photo in the body of the report that retrieves the image from the database and use an expression to give it a value:
=System.Convert.ToBase64String(Fields!Photo.Value)
In the header, add an Image control which uses the TXT_Photo text box, decoded to show the image:
=System.Convert.FromBase64String(ReportItems!TXT_Photo.Value)

-X-
but I am not getting the image.
The error message displayed is like this
[rsInvalidExpressionDataType] The Value expression used in image ‘image2’ returned a data type that is not valid.
Can any one help me in this regard.
Thanks in advance.
Ramesh

What's the image source type of the image reportitem? Is it set to "Database"?

-- Robert

|||

If the image was saved to the database via MS Access, the solution is here: http://forums.devarticles.com/microsoft-sql-server-5/displaying-image-fields-in-reporting-services-11844.html . In brief, as it states, instead of utilizing the hidden text box and Base64 strings, simply use this piece of code to set the Value property of your RS image control:

=System.Text.Encoding.Default.GetBytes(Mid(System.Text.Encoding.Default.GetString(Fields!Picture.Value),XXX))

For English use XXX = 79
For Spanish use XXX = 89

(The image control should still have its Source property set to Database.)

|||

u can do that with the help of parameters

1) add a calculated field in dataset named imagebase64 in that add the following expression

Convert.ToBase64String(Fields!Photo.value)

2)Add report Parameter named image

set the datatype as string.