Showing posts with label vs2005. Show all posts
Showing posts with label vs2005. Show all posts

Monday, March 26, 2012

Problem rendering to Excel when using SOAP

I'm using Reporting Services 2005 with VS2005 and getting garbage when setting format=excel. (snippit below) All the other formats work fine and excel works fine if I use URL access with the report manager for the same report.

Any ideas how to troubleshoot this? My SOAP code is as follows:

Dim reportAsByte() =NothingDim rsAs report_engine.ReportExecutionService =New report_engine.ReportExecutionService'credentials

rs.Credentials =

New System.Net.NetworkCredential("zzzzzzz","zzzzzzzzz","zzzzzzzzzzz")

rs.PreAuthenticate =

TrueDim reportpathAsString ="/" & System.Configuration.ConfigurationManager.AppSettings("report_folder") &"/" & report_nameDim zoomAsString ="False"Dim streamRootAsString =NothingDim deviceInfoAsString =NothingSelectCase formatCase"HTML4.0","HTML3.2"

deviceInfo =

"<DeviceInfo>"

deviceInfo &=

"<StreamRoot>" & streamRoot &"</StreamRoot>"

deviceInfo &=

"<Toolbar>False</Toolbar>"

deviceInfo &=

"<Parameters>False</Parameters>"

deviceInfo &=

"<HTMLFragment>True</HTMLFragment>"

deviceInfo &=

"<StyleStream>False</StyleStream>"

deviceInfo &=

"<Section>0</Section>"

deviceInfo &=

"<Zoom>" & zoom &"</Zoom>"

deviceInfo &=

"</DeviceInfo>"CaseElse

deviceInfo =

"<DeviceInfo></DeviceInfo>"EndSelect'variables for the remaining paramtersDim historyIDAsString =NothingDim credentialsAs report_engine.DataSourceCredentials =NothingDim showHideToggleAsString =NothingDim encodingAsStringDim mimeTypeAsStringDim warnings()As report_engine.Warning =NothingDim reportHistoryParameters()As report_engine.ParameterValue =NothingDim streamIDS()AsString =NothingDim execInfoAsNew report_engine.ExecutionInfoDim execHeaderAsNew report_engine.ExecutionHeader

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportpath, historyID)

Try'execute the report

report = rs.Render(Format, deviceInfo,

"", mimeType,"", warnings, streamIDS)'flush any pending response

Response.Clear()

'set the http headers for a PDF response

HttpContext.Current.Response.ClearHeaders()

HttpContext.Current.Response.ClearContent()

HttpContext.Current.Response.ContentType =

"text/html"'filename is the default filename displayed

HttpContext.Current.Response.AppendHeader(

"Content-Disposition","filename=""" & savefilename &"""")'send the byte array containing the report

HttpContext.Current.Response.BinaryWrite(report)

HttpContext.Current.Response.End()

Catch exAs ExceptionIf ex.Message ="Thread was being aborted."Then

HttpContext.Current.Response.ClearHeaders()

HttpContext.Current.Response.ClearContent()

HttpContext.Current.Response.ContentType =

"text/html"

HttpContext.Current.Response.Write(

"<HTML><body><h1>Error</h1><br>" & ex.Message &"</body></html>")EndIfEndTry

Here's the garbage that is generated:

? ? ?> ? ?????????????????????????????????????? !"#$%&'()*+,-./0123456789:;<=>?@.ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi?????????ot Entry ?? `?# v??Workbook ? ??? ? ? ?? ? ?\p B ? a ?= ? ? ? = ??? X @. ? " ? ? 1 ?? Arial1 ?? Arial1 ?? Arial1 ?? Arial1 ? ? Arial1 @. ? Arial 3 "$"#,##0_);\("$"#,##0\) = "$"#,##0_);[Red]\("$"#,##0\) ? "$"#,##0.00_);\("$"#,##0.00\) I " "$"#,##0.00_);[Red]\("$"#,##0.00\) i*2 _("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@._) W)) _(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@._) y,: _("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@._) g+1 _(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@._) )? [$-1010409]General?? ????? ????? ????? ??????????????????????????????????? (?? +?? )?? ,?? *?? ?? `@.@.?? `@.?? ` @.?? `@.?? `@. @. ?? @.?? `@. @. ?? ` ?? `@. @. ?? `"" ?? `"" ?? `"" ? ? ? `"" ?? ? `"" ? ? `@. ?? `@. @. ? ? ` ?? ? ? ? ? ? ? ? ? ? ??0需 drugs_for_reordering? ? ??8 ? ?? ?? ?R ? 3????;s??? ?F ??3????;s????JFIF HH? (" & #0$&*+-.- "251,5(,-,? , ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,? 0 " ? ? } !1A Qa "q 2? #B??R?$3br? %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz????????????????????????稩????? ? w !1 AQ aq "2? B??#3R??ъ $4? &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz??????????????????????妧詪???? ??E?? ?{?[??z.?e??? Z????????=?黄a??Y? ??w ??8?Μ ??z?qZ]???&o x??????? г??達??4????? ?a?M'? ы F? zWQ_5x UO x??\G K??仄? ?? ??8z?<?????? Q?fv8 Rk??? ?M?w???%#?o??'°xz?_k??X???B????f?K???d\??? ?Ty??????U Nk??h|*?a?

I solved my own issue. I was setting the headers wrong. Needed to change

HttpContext.Current.Response.ContentType =

"text/html"

to excel

sql

Saturday, February 25, 2012

Problem install RS2000

hi,I have a W2003 Server Standard Edition.I Installed VS2005 with ASP 2.0
,For some reasons My DB is SQL SERVER 2000.
Now I tried to install RS2000-So first I installed VS2003 and when the
install started i got error that ASP.NET 1.1 isn't registered,although it is!
So I removed The IIS(6.0) and Re-installed it,and then I preform
"aspnet_regiis.exe -i" for both 1.1 and 2.0 but still i get this error that
1.1 isn't register...
Any Idea?Several issues. First, if you want RS 2005 can use SQL 2000 for its
object/metadata storage. If your server is on a different box than where you
are developing you do not need to install VS at all.
RS 2000 tries to install to the default website. Check in IIS what version
of dotnet the default website is running. It must be 1.1.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"'" <@.discussions.microsoft.com> wrote in message
news:0DCF02DD-5671-4C89-BFB6-6579D52DA671@.microsoft.com...
> hi,I have a W2003 Server Standard Edition.I Installed VS2005 with ASP 2.0
> ,For some reasons My DB is SQL SERVER 2000.
> Now I tried to install RS2000-So first I installed VS2003 and when the
> install started i got error that ASP.NET 1.1 isn't registered,although it
> is!
> So I removed The IIS(6.0) and Re-installed it,and then I preform
> "aspnet_regiis.exe -i" for both 1.1 and 2.0 but still i get this error
> that
> 1.1 isn't register...
> Any Idea?
>

Monday, February 20, 2012

Problem inserting data from IDictionary into Sql2005

Hi,

I'm not sure if this should be in the Sql or VB forums.

Using VS2005 I have a graphics program which holds data in a Dictionary Object.

The data consists of a Key and a Structure called Arrows. This structure holds a startpoint and an endpoint, both of which consist of x and y co-ordinates. I need to insert these four co-ordinates into X,Y,X1 and Y1 columns of a table,

The following Insert statement will insert the correct IdKey and Textbox data, but will not compile the co-ordinates.

I have initialised the Points of the structure, but get the error message that Type is not defined.

With dbCommand

Dim _mstartPoint As Point

Dim _mendPoint As Point

Dim strSql As String

For Each kvp As KeyValuePair(Of String, Arrow) In Arrows

strSql = "INSERT INTO Drawing_Arrows (ArrowId,FlashingCode,X1,Y1,X2,Y2) Values ('" & kvp.Key & "', '" & txt_Title.Text & "','" & CType(Arrows(kvp.Key), _mstartPoint).x.ToString & "', '" & CType(Arrows(kvp.Key), _mstartPoint).y.ToString & "''" & CType(Arrows(kvp.Key), _mendPoint).x.ToString & "', '" & CType(Arrows(kvp.Key), _mendPoint).y.ToString & "')"

.CommandText = strSql

.CommandType = Data.CommandType.Text

.Connection = dbConnection

.ExecuteNonQuery()

Next

End With

My problem is how to extract the _mstartPoint x and _mstartPoint y as seperate items for insertion into X and Y in the table.

Any suggestions welcome.

Tailor

Hi,

Finally figured out the way to do answer this question. use IDictionaryEnumerator. Code as shown, works.

Dim arrowEnumerator As IDictionaryEnumerator = Arrows.GetEnumerator

Do While arrowEnumerator.MoveNext

strSql = "INSERT INTO Drawing_Arrows (ArrowId,FlashingCode,X1,Y1,X2,Y2) Values ('" & _uniqueID & "','" & txt_Title.Text & "','" & CType(arrowEnumerator.Value, Arrow).StartPoint.X.ToString & "', '" & CType(arrowEnumerator.Value, Arrow).StartPoint.Y.ToString & "', '" & CType(arrowEnumerator.Value, Arrow).EndPoint.X.ToString & "', '" & CType(arrowEnumerator.Value, Arrow).EndPoint.Y.ToString & "')"

.CommandText = strSql

.CommandType = Data.CommandType.Text

.Connection = dbConnection

.ExecuteNonQuery()

Loop

Probably no use to anyone else, but posted it in case.

Tailor