Monday, March 26, 2012
Problem with an IIF Statement
group plus the field the group was based on.
But if the group was based on a an empty string I get an #error in the
textbox.
So I wrapped the code with an IIF statement. If the field is empty do
nothing otherwise build the string.
= IIF(Fields!AdjustmentCode.Value = "","No Adjustment
Code",countrows("grpAdjustmentDesc") & " Records for Adjustment Code
Description: " & Fields!AdjustmentCode.Value.trim & " - " &
Fields!AdjustmentDescription.Value.tolower)FYI this is the error: The value expression for the textbox
'textbox35' contains an error: Object variable or With block
variable not set.|||VB.Net evaluates all parts of the IIF which is why you get the error. It
does not just evaluate the true portion. You could use code behind report to
do this.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"PAPutzback" <phillip_putzback@.insightbb.com> wrote in message
news:1128709777.373098.129000@.g49g2000cwa.googlegroups.com...
> In my group footer I build a string based on the number of rows in that
> group plus the field the group was based on.
> But if the group was based on a an empty string I get an #error in the
> textbox.
> So I wrapped the code with an IIF statement. If the field is empty do
> nothing otherwise build the string.
> = IIF(Fields!AdjustmentCode.Value = "","No Adjustment
> Code",countrows("grpAdjustmentDesc") & " Records for Adjustment Code
> Description: " & Fields!AdjustmentCode.Value.trim & " - " &
> Fields!AdjustmentDescription.Value.tolower)
>|||Can you point me in some direction for a Code Behind example. I can't
find anything yet.
Thanks.|||Look in books on line for the phrase code block
They have an example with that. I tend to develop my code in vb.net, test it
and then copy it over.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"PAPutzback" <phillip_putzback@.insightbb.com> wrote in message
news:1128712212.284978.143180@.z14g2000cwz.googlegroups.com...
> Can you point me in some direction for a Code Behind example. I can't
> find anything yet.
> Thanks.
>|||All i see is XML. This is going to be a lot of work to just handle the
fact the the Rpt can't handle a blank value.
So your saying I can put vb code in this.
<Textbox Name="textbox35">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<TextAlign>Left</TextAlign>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>25</ZIndex>
<rd:DefaultName>textbox35</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>= countrows("grpAdjustmentDesc") &
" Records for Adjustment Code Description: " &
Fields!AdjustmentCode.Value.trim & " - " &
Fields!AdjustmentDescription.Value.tolower</Value>
</Textbox>|||Can you post the hyperlink from the RSBook online address bar to where
the sample is.|||I put this in the code window
<Code>
Public Function test() As String
Dim strTest As String
strTest = "BLAH BLAH BLAH"
Return strTest
End Function
</Code>
I put this in a textbox
= code.test()
d:\phfxclaims\Pending Claims Detail.rdl There is an error on line 0 of
custom code: [BC32035] Attribute specifier is not a complete statement.
Use a line continuation to apply the attribute to the following
statement.
And this is my error|||You should not be having to modify the rdl at all (which is what you are
doing).
Search Books Online for the phrase: writing custom code
Also these two links:
ms-help://MS.RSBOL80.1033/RSCREATE/htm/rcr_creating_expressions_v1_84f9.htm
ms-help://MS.RSBOL80.1033/RShowto/htm/hrs_designer_v1_1nfp.htm
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"PAPutzback" <phillip_putzback@.insightbb.com> wrote in message
news:1128719715.084263.60890@.g43g2000cwa.googlegroups.com...
>I put this in the code window
> <Code>
> Public Function test() As String
> Dim strTest As String
> strTest = "BLAH BLAH BLAH"
> Return strTest
> End Function
> </Code>
>
> I put this in a textbox
> = code.test()
>
> d:\phfxclaims\Pending Claims Detail.rdl There is an error on line 0 of
> custom code: [BC32035] Attribute specifier is not a complete statement.
> Use a line continuation to apply the attribute to the following
> statement.
> And this is my error
>|||Thanks for the links. I finally got it to work
I had cut and pasted the code from this article
http://www.15seconds.com/issue/041110.htm and I had the tags in there
which were getting placed in the XML definition
Thanks for the quick responses
Friday, March 23, 2012
Problem with adding record into database
What's the problem?
Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'If Page.IsValid Then
Try
Dim MySQL = "addCustomerSQL"
Dim cmd As New SQLCommand("addCustomerSQL", dbConn)
cmd.Commandtype() = CommandType.StoredProcedure
cmd.Parameters().Item("@.username").Value = userText.Text
cmd.Parameters.Item("@.password").Value = passText.Text
dbConn.Open()
cmd.ExecuteNonQuery()
dbConn.Close()
Catch ex As Exception
End Try
End SubMake sure you're importing System.Data.SqlClient in your class|||Where would I put that?|||At the top of your page type this
Imports System.Data.SqlClient
Public Class......|||To follow up, I was able to get the code to compile, but nothing is being transferred to the database table after clicking submit.
Private Sub submitButton_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs)'If Page.IsValid
Try
Dim MySQL = "addCustomerSQL"
Dim dbConn As New System.Data.SqlClient.SqlConnection
Dim cmd As New SqlCommand("addCustomerSQL", dbConn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@.username", KuserTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.password", KpassTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.fullname", KfnameTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.email_address", KemailTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.phone_nbr", KphoneTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.mailing_address", KaddressTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.credit_card_name", KccNameTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.credit_card_nbr", KccNumTextLI.Text))
cmd.Parameters.Add(New SqlParameter("@.credit_card_expiry_date", KccExpTextLI.Text))
cmd.Parameters.Item("@.username").Value = KuserTextLI.Text
cmd.Parameters.Item("@.password").Value = KpassTextLI.Text
cmd.Parameters.Item("@.fullname").Value = KfnameTextLI.Text
cmd.Parameters.Item("@.email_address").Value = KemailTextLI.Text
cmd.Parameters.Item("@.phone_nbr").Value = KphoneTextLI.Text
cmd.Parameters.Item("@.mailing_address").Value = KaddressTextLI.Text
cmd.Parameters.Item("@.credit_card_name").Value = KccNameTextLI.Text
cmd.Parameters.Item("@.credit_card_nbr").Value = KccNumTextLI.Text
cmd.Parameters.Item("@.credit_card_expiry_date").Value = KccExpTextLI.Text
dbConn.Open()
cmd.ExecuteNonQuery()
dbConn.Close()
Response.Redirect("http://localhost/KevinLiu/thankyou.aspx")Catch ex As Exception
End Try
End Sub
Is there anything I need to put under the Page_Load procedure? Or how about on my html page, do I have to call the event procedure from there?
The Database tables were created first in a .sql file, so is it necessary to include the attributes in my Parameters.Add lines?|||Hi,
im not sure... but i think that the main problem would be the parameter name must be the same as the input variable name in your stored procedure.
anyway your codes are somewhat redundant. The following 2 lines are doing the same thing.
cmd.Parameters.Add(New SqlParameter("@.username", KuserTextLI.Text))
cmd.Parameters.Item("@.username").Value = KuserTextLI.Text
this would be enought if you are adding a sql parameter of type VarChar in:
cmd.Parameters.add(new sqlparameter("@.username", kusertextLi.text))
and this would give you a sql parameter of type Numeric :
cmd.Parameters.add(new sqlparameter("@.age", cint(kagetextLi.text))
note that if your stored procedure has output variables you have to specify the direction of the parameters. Example:
dim param as new sqlparameter("@.username", kusertextLi.text))
param.direction = parameterdirection.input
Wednesday, March 21, 2012
problem with ##xp_cmdshell_proxy_account##
I was trying to debug a situation where we need to use xp_cmdshell in
SQL2005 SP2 build 3175. I had created the ##xp_cmdshell_proxy_account##
proxy credential and wanted to delete it to see that I was getting a message
about the credential missing. After running the sp_xp_cmdshell_proxy_account
stored proc with NULL I ran it again to re-create the proxy credential but
this time I got message: -
Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
An error occurred during the execution of sp_xp_cmdshell_proxy_account.
Possible reasons: the provided account was invalid or the
'##xp_cmdshell_proxy_account##' credential could not be created. Error code:
'997'.
This is on a clustered server so do I need to flip the cluster for the
credential to be completed deleted before trying to add it again?
Thanks
ChrisI am having the same issue. I am simply trying to assign xp_cmdshell a proxy
account and its not allowing me to. I know that the username/password is a
valid one.
Any help would be appreciated. Thanks Amir
"Chris Wood" wrote:
> Hi,
> I was trying to debug a situation where we need to use xp_cmdshell in
> SQL2005 SP2 build 3175. I had created the ##xp_cmdshell_proxy_account##
> proxy credential and wanted to delete it to see that I was getting a message
> about the credential missing. After running the sp_xp_cmdshell_proxy_account
> stored proc with NULL I ran it again to re-create the proxy credential but
> this time I got message: -
> Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
> An error occurred during the execution of sp_xp_cmdshell_proxy_account.
> Possible reasons: the provided account was invalid or the
> '##xp_cmdshell_proxy_account##' credential could not be created. Error code:
> '997'.
> This is on a clustered server so do I need to flip the cluster for the
> credential to be completed deleted before trying to add it again?
> Thanks
> Chris
>
>
>
>|||Amir,
Rather than run the stored proc I just created the proxy credential by using
the create credential T-SQL statement.
Chris
"Amir" <Amir@.discussions.microsoft.com> wrote in message
news:61B89673-4894-419A-9D82-6D99C7559878@.microsoft.com...
>I am having the same issue. I am simply trying to assign xp_cmdshell a
>proxy
> account and its not allowing me to. I know that the username/password is a
> valid one.
> Any help would be appreciated. Thanks Amir
> "Chris Wood" wrote:
>> Hi,
>> I was trying to debug a situation where we need to use xp_cmdshell in
>> SQL2005 SP2 build 3175. I had created the ##xp_cmdshell_proxy_account##
>> proxy credential and wanted to delete it to see that I was getting a
>> message
>> about the credential missing. After running the
>> sp_xp_cmdshell_proxy_account
>> stored proc with NULL I ran it again to re-create the proxy credential
>> but
>> this time I got message: -
>> Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account,
>> Line 1
>> An error occurred during the execution of sp_xp_cmdshell_proxy_account.
>> Possible reasons: the provided account was invalid or the
>> '##xp_cmdshell_proxy_account##' credential could not be created. Error
>> code:
>> '997'.
>> This is on a clustered server so do I need to flip the cluster for the
>> credential to be completed deleted before trying to add it again?
>> Thanks
>> Chris
>>
>>
>>
Friday, March 9, 2012
Problem when deploying Reports
Hello, I am working on SQL Server 2005 Reporting Services embedded in the Visual Studio 2005. I ve build reports perefctly, but the problem raised when I tried to deploy this report:
I am deploying these report with a debug configuration , and I have tried with the 2 TargetServerURL:
http://localhost/reportserver$sql2005
http://localhost/reportserver
The Error message is the following:
TITLE: Microsoft Report Designer
A connection could not be made to the report server http://localhost/reportserver$sql2005.
ADDITIONAL INFORMATION:
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
<title>Configuration Error</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Configuration Error</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
<br><br>
<b> Parser Error Message: </b>Could not load type 'Microsoft.Web.Services.ScriptModule'. (c:\inetpub\wwwroot\web.config line 123)<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
Line 121: </httpHandlers>
Line 122: <httpModules>
<font color=red>Line 123: <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
</font>Line 124: <add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/>
Line 125: <add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/></pre></code>
</td>
</tr>
</table>
<br>
<b> Source File: </b> c:\inetpub\wwwroot\web.config<b> Line: </b> 123
<br><br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
</font>
</body>
</html>
<!--
[ConfigurationErrorsException]: Could not load type 'Microsoft.Web.Services.ScriptModule'. (c:\inetpub\wwwroot\web.config line 123) (c:\inetpub\wwwroot\web.config line 123)
at System.Web.Configuration.HttpModuleAction.get_Entry()
at System.Web.Configuration.HttpModulesSection.CreateModules()
at System.Web.HttpApplication.InitModules()
at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers)
at System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context)
at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
-->
--. (Microsoft.ReportingServices.Designer)
BUTTONS:
OK
How Should I proceed to remedy this?
Thanks in advance
make sure report server is running.
please let me know what u r getting when access " http://localhost/reportserver"
|||
Well, when runing the reportServer URL, this error message was displayed
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load type 'Microsoft.Web.Services.ScriptModule'. (c:\inetpub\wwwroot\web.config line 123)
Source Error:
Line 121:</httpHandlers>Line 122:<httpModules>
Line 123:<add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
Line 124:<add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/>
Line 125:<add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>
What Can I do to load this module? Thanks
Wednesday, March 7, 2012
Problem using Visual Studio 2008 Winforms ReportViewer
reports (using VS 2005 (sigh)) and am now tryiing to render them using a
Windows form and the ReportViewer control in the VS 2008 app. However I
always get the error message "The source of the report definition has not
been specified" when I execute the line
m_reportViewer.RefreshReport();
When I try to view the very same report in a VS 2005 app it renders without
error. I can also view the report using Report Manager and preview it in the
VS 2005 app I use to build it. Any suggestions?
Thx
Helen
--
Helen Warn, PhD
Agile Software Inc.
www.agile-soft.comNever mind. I added and removed the ReportViewer control a few times,
switching between Versino 8 & Version 9, and finally it worked :)
--
Helen Warn, PhD
Agile Software Inc.
www.agile-soft.com