Showing posts with label setting. Show all posts
Showing posts with label setting. 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

Problem removing trailing spaces

Hi,
I am very new to SQL and made a dumb mistake when setting up my
database. I have some small tables I used for drop-down-lists in a web
page I designed. I used a datatype of CHAR. Well, I should have used
VARCHAR as it is causing me problems now.
I have redesigned the site so the drop-down-lists are not pulled from
the SQL table. The problem is that every record created with one of
these dropdown values has trailing spaces. In other words, if the field
was CHAR with length 10 when we store Canada, it is really
Canada<space><space><space><space>.
I have found one way to fix this:
UPDATE mytable
SET country='Canada' WHERE country='Canada'
This has the effect of removing the spaces. I guess I could also use:
UPDATE mytable
SET country='Canada' WHERE country LIKE '%Canada%'
This is WAY too tedious to do for every value of every column I have
this problem with. Is there a way to iterate through the database a
remove ALL trailing spaces?
I appreciate the help!So you have changed the datatype in the table and want to get rid of the tra
iling spaces in the
varchar column?
UPDATE tblname
SET col = RTRIM(col)
Pls test above first, just in case...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<mattmerc@.bellsouth.net> wrote in message
news:1124996454.969917.40520@.o13g2000cwo.googlegroups.com...
> Hi,
> I am very new to SQL and made a dumb mistake when setting up my
> database. I have some small tables I used for drop-down-lists in a web
> page I designed. I used a datatype of CHAR. Well, I should have used
> VARCHAR as it is causing me problems now.
> I have redesigned the site so the drop-down-lists are not pulled from
> the SQL table. The problem is that every record created with one of
> these dropdown values has trailing spaces. In other words, if the field
> was CHAR with length 10 when we store Canada, it is really
> Canada<space><space><space><space>.
> I have found one way to fix this:
> UPDATE mytable
> SET country='Canada' WHERE country='Canada'
> This has the effect of removing the spaces. I guess I could also use:
> UPDATE mytable
> SET country='Canada' WHERE country LIKE '%Canada%'
> This is WAY too tedious to do for every value of every column I have
> this problem with. Is there a way to iterate through the database a
> remove ALL trailing spaces?
> I appreciate the help!
>|||I read about RTRIM but didn't realize it could be used that way. I will
test it. Thanks!
Tibor Karaszi wrote:
> So you have changed the datatype in the table and want to get rid of the t
railing spaces in the
> varchar column?
> UPDATE tblname
> SET col = RTRIM(col)
> Pls test above first, just in case...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> <mattmerc@.bellsouth.net> wrote in message
> news:1124996454.969917.40520@.o13g2000cwo.googlegroups.com...|||First, in Enterprise Manager you need to redefine the Char(10) column as
VarChar(30), becuase Char columns cannot be trimmed. The rtrim() function
will returns a string with trailing spaces trimmed. You will probably want
to trim every country in the table, so there is no need to specify a where
clause.
UPDATE mytable SET country = rtrim(country)
http://sqlcourse.com/create.html
http://sqlcourse.com/update.html
<mattmerc@.bellsouth.net> wrote in message
news:1124996454.969917.40520@.o13g2000cwo.googlegroups.com...
> Hi,
> I am very new to SQL and made a dumb mistake when setting up my
> database. I have some small tables I used for drop-down-lists in a web
> page I designed. I used a datatype of CHAR. Well, I should have used
> VARCHAR as it is causing me problems now.
> I have redesigned the site so the drop-down-lists are not pulled from
> the SQL table. The problem is that every record created with one of
> these dropdown values has trailing spaces. In other words, if the field
> was CHAR with length 10 when we store Canada, it is really
> Canada<space><space><space><space>.
> I have found one way to fix this:
> UPDATE mytable
> SET country='Canada' WHERE country='Canada'
> This has the effect of removing the spaces. I guess I could also use:
> UPDATE mytable
> SET country='Canada' WHERE country LIKE '%Canada%'
> This is WAY too tedious to do for every value of every column I have
> this problem with. Is there a way to iterate through the database a
> remove ALL trailing spaces?
> I appreciate the help!
>|||You can also use the RTRIM() function, but this still require you to update
every column. Although it might be easier to drop, recreate the tables
using varchar, and reload them.
--Brian
(Please reply to the newsgroups only.)
<mattmerc@.bellsouth.net> wrote in message
news:1124996454.969917.40520@.o13g2000cwo.googlegroups.com...
> Hi,
> I am very new to SQL and made a dumb mistake when setting up my
> database. I have some small tables I used for drop-down-lists in a web
> page I designed. I used a datatype of CHAR. Well, I should have used
> VARCHAR as it is causing me problems now.
> I have redesigned the site so the drop-down-lists are not pulled from
> the SQL table. The problem is that every record created with one of
> these dropdown values has trailing spaces. In other words, if the field
> was CHAR with length 10 when we store Canada, it is really
> Canada<space><space><space><space>.
> I have found one way to fix this:
> UPDATE mytable
> SET country='Canada' WHERE country='Canada'
> This has the effect of removing the spaces. I guess I could also use:
> UPDATE mytable
> SET country='Canada' WHERE country LIKE '%Canada%'
> This is WAY too tedious to do for every value of every column I have
> this problem with. Is there a way to iterate through the database a
> remove ALL trailing spaces?
> I appreciate the help!
>

Tuesday, March 20, 2012

Problem of vale setting

I have this .NET (VB) code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim myConnection As New SqlConnection(ConnectionString)
myConnection.Open()

Dim CommandText As String = "SELECT firstName FROM students Where Students.ID='" & IDinput & "' "

Dim myCommand As New SqlCommand(CommandText, myConnection)

'****this the problem, somthing is mising here******
Dim name As String = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

end sub

The SQL qurey return only one record each time (only one student name with specific ID number)

I want that variable "name" will get the value of the "firstName" filed.

How to do it??Use ExecuteScalar instead of ExecuteReader. ExecuteScalar is designed for situations like this where you want the query to return a single value.

Wednesday, March 7, 2012

problem installing sql server express

help i'm having serious problems installing sql server express and quite at a loss.

i'm stuck at SQL Server Database Services and at Setting File Security. Can someone help? Seeing the SQL Server Database Services log i get this:

Action start 22:25:56: Write_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2.
<Func Name='LaunchFunction'>
Function=Write_sqlUserSecurity
<Func Name='SetCAContext'>
<EndFunc Name='SetCAContext' Return='T' GetLastError='203'>
Doing Action: Write_sqlUserSecurity
PerfTime Start: Write_sqlUserSecurity : Thu Dec 01 22:25:56 2005
<Func Name='Write_sqlUserSecurity'>
<Func Name='ScheduleActionX'>
<Func Name='SetCAContext'>
MSI (s) (44!E8) [22:25:56:417]: PROPERTY CHANGE: Adding Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2 property. Its value is '0 1 0 Setting User Security 50000 SQLServer2005SQLBrowserUser$ZSG03-1030 SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeBatchLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeAssignPrimaryTokenPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeChangeNotifyPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeIncreaseQuotaPrivilege '.
MSI (s) (44!E8) [22:25:56:417]: Doing action: Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2
<EndFunc Name='SetCAContext' Return='T' GetLastError='0'>
Action start 22:25:56: Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2.
MSI (s) (44!E8) [22:25:56:417]: PROPERTY CHANGE: Deleting Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2 property. Its current value is '0 1 0 Setting User Security 50000 SQLServer2005SQLBrowserUser$ZSG03-1030 SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeBatchLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeAssignPrimaryTokenPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeChangeNotifyPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeIncreaseQuotaPrivilege '.
Action ended 22:25:56: Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2. Return value 1.
<EndFunc Name='ScheduleActionX' Return='0' GetLastError='0'>
<EndFunc Name='Write_sqlUserSecurity' Return='0' GetLastError='0'>
PerfTime Stop: Write_sqlUserSecurity : Thu Dec 01 22:25:56 2005
<EndFunc Name='LaunchFunction' Return='0' GetLastError='0'>
MSI (s) (44:E4) [22:25:56:433]: Doing action: Write_sqlFileSDDL.D20239D7_E87C_40C9_9837_E70B8D4882C2
Action ended 22:25:56: Write_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2. Return value 1.
MSI (s) (44:DC) [22:25:56:448]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIED.tmp, Entrypoint: Write_sqlFileSDDL
Action start 22:25:56: Write_sqlFileSDDL.D20239D7_E87C_40C9_9837_E70B8D4882C2.
<Func Name='LaunchFunction'>
Function=Write_sqlFileSDDL
<Func Name='SetCAContext'>
<EndFunc Name='SetCAContext' Return='T' GetLastError='203'>
Doing Action: Write_sqlFileSDDL
PerfTime Start: Write_sqlFileSDDL : Thu Dec 01 22:25:56 2005

I'm having the same problem installing SQL 2005 Enterprise Edtion. Once it gets to the "Setting File Security...", it just sits there hung. The only way to kill it is using the Task Manager.

It also looked like it was hung during "Installing Local Goups", but after 30 minutes or so, it moved on.

Hopefully someone from Microsoft can help us out!!!

|||... I'm having the same problem with the developer edition :(|||PROBLEM SOLVED : (?) Well, I think. I still need to test, but at least the install finished without error. Yesterday, I started the install at 2:46 PM and just let it run. Almost 8 hours later at 10:33 PM it finished.

I only installed the SQL Server. I'll start the install for the services now and get back to you later when it finishes. It shouldn't take more than a few days! Tongue Tied|||Good news, it only took 3.5 more hours to install all the services. Yes, it looked like it was hung there a few times, but I just let it go. Big Smile|||There is a workaround documented at
http://support.microsoft.com/?kbid=910070

-Jeffrey Baker
SQL Server Setup|||

Or simply disable your network temporarily if you are not installing from a network drive. Works like a charm !

Visit : http://sqljunkies.com/WebLog/simons/archive/2007/06/01/SQL_2005_install_hangs_on__Setting_File_Security_.aspx

SQL 2005 install hangs on &quot;Setting File Security&quot;

When doing an install of SQL 2005 you may encounter the install hanging on the "setting file security" stage.

This is due to th install trying to do some security resolution with domain controllers.

The easiest answer is to unplug the network cable (or disable the network interface), however if you are doing a remote install that may not be possible.

This KB discusses the issue http://support.microsoft.com/kb/910070/en-us and does provide hotfix which can be applied to the install so you don't encounter the problem

problem installing sql server express

help i'm having serious problems installing sql server express and quite at a loss.

i'm stuck at SQL Server Database Services and at Setting File Security. Can someone help? Seeing the SQL Server Database Services log i get this:

Action start 22:25:56: Write_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2.
<Func Name='LaunchFunction'>
Function=Write_sqlUserSecurity
<Func Name='SetCAContext'>
<EndFunc Name='SetCAContext' Return='T' GetLastError='203'>
Doing Action: Write_sqlUserSecurity
PerfTime Start: Write_sqlUserSecurity : Thu Dec 01 22:25:56 2005
<Func Name='Write_sqlUserSecurity'>
<Func Name='ScheduleActionX'>
<Func Name='SetCAContext'>
MSI (s) (44!E8) [22:25:56:417]: PROPERTY CHANGE: Adding Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2 property. Its value is '0 1 0 Setting User Security 50000 SQLServer2005SQLBrowserUser$ZSG03-1030 SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeBatchLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeAssignPrimaryTokenPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeChangeNotifyPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeIncreaseQuotaPrivilege '.
MSI (s) (44!E8) [22:25:56:417]: Doing action: Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2
<EndFunc Name='SetCAContext' Return='T' GetLastError='0'>
Action start 22:25:56: Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2.
MSI (s) (44!E8) [22:25:56:417]: PROPERTY CHANGE: Deleting Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2 property. Its current value is '0 1 0 Setting User Security 50000 SQLServer2005SQLBrowserUser$ZSG03-1030 SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeServiceLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeBatchLogonRight SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeAssignPrimaryTokenPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeChangeNotifyPrivilege SQLServer2005MSSQLUser$ZSG03-1030$SQLEXPRESS SeIncreaseQuotaPrivilege '.
Action ended 22:25:56: Do_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2. Return value 1.
<EndFunc Name='ScheduleActionX' Return='0' GetLastError='0'>
<EndFunc Name='Write_sqlUserSecurity' Return='0' GetLastError='0'>
PerfTime Stop: Write_sqlUserSecurity : Thu Dec 01 22:25:56 2005
<EndFunc Name='LaunchFunction' Return='0' GetLastError='0'>
MSI (s) (44:E4) [22:25:56:433]: Doing action: Write_sqlFileSDDL.D20239D7_E87C_40C9_9837_E70B8D4882C2
Action ended 22:25:56: Write_sqlUserSecurity.D20239D7_E87C_40C9_9837_E70B8D4882C2. Return value 1.
MSI (s) (44:DC) [22:25:56:448]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIED.tmp, Entrypoint: Write_sqlFileSDDL
Action start 22:25:56: Write_sqlFileSDDL.D20239D7_E87C_40C9_9837_E70B8D4882C2.
<Func Name='LaunchFunction'>
Function=Write_sqlFileSDDL
<Func Name='SetCAContext'>
<EndFunc Name='SetCAContext' Return='T' GetLastError='203'>
Doing Action: Write_sqlFileSDDL
PerfTime Start: Write_sqlFileSDDL : Thu Dec 01 22:25:56 2005

I'm having the same problem installing SQL 2005 Enterprise Edtion. Once it gets to the "Setting File Security...", it just sits there hung. The only way to kill it is using the Task Manager.

It also looked like it was hung during "Installing Local Goups", but after 30 minutes or so, it moved on.

Hopefully someone from Microsoft can help us out!!!

|||... I'm having the same problem with the developer edition :(|||PROBLEM SOLVED : (?) Well, I think. I still need to test, but at least the install finished without error. Yesterday, I started the install at 2:46 PM and just let it run. Almost 8 hours later at 10:33 PM it finished.

I only installed the SQL Server. I'll start the install for the services now and get back to you later when it finishes. It shouldn't take more than a few days! Tongue Tied|||Good news, it only took 3.5 more hours to install all the services. Yes, it looked like it was hung there a few times, but I just let it go. Big Smile|||There is a workaround documented at
http://support.microsoft.com/?kbid=910070

-Jeffrey Baker
SQL Server Setup|||

Or simply disable your network temporarily if you are not installing from a network drive. Works like a charm !

Visit : http://sqljunkies.com/WebLog/simons/archive/2007/06/01/SQL_2005_install_hangs_on__Setting_File_Security_.aspx

SQL 2005 install hangs on &quot;Setting File Security&quot;

When doing an install of SQL 2005 you may encounter the install hanging on the "setting file security" stage.

This is due to th install trying to do some security resolution with domain controllers.

The easiest answer is to unplug the network cable (or disable the network interface), however if you are doing a remote install that may not be possible.

This KB discusses the issue http://support.microsoft.com/kb/910070/en-us and does provide hotfix which can be applied to the install so you don't encounter the problem