Hi all, I have newly implemented a Try, Catch in my code (pasted below) and for some reason when I try to have the text of a label changed in the Catch exception, it says "Build failed" and doesn't tell me where the error is. Could anyone tell me what they can see is wrong please? Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try 'error handler for if there is a dulplicate tillname in database (e.g. when user clicks refresh after submit)
Catch ex As SqlException 'What to do if there is a duplicate tillname
'Label2.Text = "test" errorLabel.Text = "This till already exists" Finally SQLDataSource1.Dispose() 'errorLabel.Text = "Till sucessfully added" End Try
End Sub
Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SQLDataSource1.Selecting
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
End Sub
Protected Sub SqlDataSource2_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource2.Selecting
II am using file system for the SSIS Packages. I have several packages in a project. Most of these packages use configuration files. Infact there are several packages which use the same configuration files. Now when I try to run the build utility, it errors out saying that the name.dtsconfig file already exists. Seems like this is a bug. I would really like to use this utility.I know if the config file is not used in any other pacakge probably the build will not fail. But it is not good practice to have one config file for each package, it is redundancy, does not make sense to that. Is there any way I can use the build and deployment utility without this error.
I've just installed SQL 2005 SP2 Rollup 3 Package (Build 3186) on a 2 node X64 W2K3 Cluster. Everything went fine, although after the install, the SQLAgent Services of my instances started to complain about delegation not enabled for the domain account used for the SQLAgent Service.
SPN's were already registered, so I've enabled unconstrained delegation & no errors anymore..
Apparently we're obliged to enable delegation as soon as this hotfix is installed
(maybe due to fix 938086 included in it ?)
To make this setup more secure, we would like to enable constrained delegation. This does not seem to work, as soon as we choose constrained delegation by adding the SPN of the clustername to the domain user account we're running with & restart the sql agent, it fails with the same error as when no delegation was configured:
! [298] SQLServer Error: 22022, CryptUnprotectData() returned error -2146892987, 'The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation.' [SQLSTATE 42000] ! [442] ConnConnectAndSetCryptoForXpstar failed (0).
Summary: With Unconstrained delegation enabled for computer account & user account, everything goes fine. As soon as constrained delegation is chosen, by adding the SPN's to the domain user account of SQL Agent, SQL agent fails to start.
We use a domain account for the SQL Agent. This account has an 2 SPN registered on it
Is it possible to add a multivalued parameter to a report from C#? I already have a C# .dll which I reference in the report. If so, could someone give some hints on how to do it?
As I searched the net for an answer to this, I came across ReportExecutionService. It looks like it's what I want, but I cant find the dll to reference in order to used this class. Does anyone know?
If it is not possible to do this from C#, then can someone please give an example on how to do it from Custom Code?
/************************************************************************************* Description: This store procedure is used to return the district's Rubric Report. Returns: RubricReport.ReportID RubricReport.LastUpdate RubricReport.LastUpdateBy RubricReportDetail.LocalPerf RubricReportDetail.GoalMet RubricReportTemplate.IndicatorNumber RubricReportTemplate.Topic RubricReportTemplate.Part RubricReportTemplate.ILCDComponent SppTarget.Target Parameters: @DataYears @County @District @LastUpdateBy
*/ ALTER PROCEDURE [dbo].[usp_RubricReportGet] -- Add the parameters for the stored procedure here @DataYears CHAR(8), @County CHAR(2), @District CHAR(4), @LastUpdateby VARCHAR(50), @ReportID INT, @LastUpdate SMALLDATETIME, @IndicatorID TINYINT, @IndicatorNumber VARCHAR(5), @Number VARCHAR(20), @FYY CHAR(9), @Part CHAR(1), @Years CHAR(8), @maxLastUpdate SMALLDATETIME, @LocalPerf DECIMAL(5,4), @GoalMet BIT, @Topic VARCHAR(100), @ILCDComponent VARCHAR(50)
AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
SET NOCOUNT ON;
-- Get the ReportID and LastUpdate values from Rubric Report Table matching -- County=@County and District=@District SELECT ReportID, LastUpdate FROM RubricReport WHERE (RubricReport.County = @County) AND (RubricReport.District = @District) AND (RubricReport.DataYears = @DataYears)
-- With table SPPIndicator and SppIndicator11Data, find the maximum value of LastUpdate (@maxLastUpdate) SELECT @maxLastUpdate FROM (SELECT LastUpdate FROM SPPIndicator UNION ALL SELECT LastUpdate FROM SppIndicator11) AS D
IF @maxLastUpdate > (SELECT LastUpdate FROM RubricReport WHERE (RubricReport.County = @County) AND (RubricReport.District = @District) AND (RubricReport.DataYears = @DataYears)) BEGIN EXEC usp_RubricReportCalc @DataYears, @County, @District, @LastUpdateBy END
ELSE
SELECT ReportID, LastUpdate, LastUpdateBy FROM RubricReport WHERE RubricReport.ReportID = RubricReportDetail.ReportID
SELECT IndicatorNumber, Topic, Part, ILCDComponent FROM RubricReportTemplate WHERE RubricReportDetail.IndicatorID = RubricReportTemplate.IndicatorID
SELECT LocalPerf, GoalMet FROM RubricReportDetail WHERE SppTarget.IndicatorNumber = RubricReportDetail.IndicatorID
SELECT Target FROM SppTarget WHERE SppTarget.Years = @DataYears
END
I have the above created stored proc. which gives the following errors:
Msg 107, Level 16, State 3, Procedure usp_RubricReportGet, Line 69 The column prefix 'RubricReportDetail' does not match with a table name or alias name used in the query. Msg 107, Level 16, State 3, Procedure usp_RubricReportGet, Line 73 The column prefix 'RubricReportDetail' does not match with a table name or alias name used in the query. Msg 107, Level 16, State 3, Procedure usp_RubricReportGet, Line 78 The column prefix 'SppTarget' does not match with a table name or alias name used in the query.
I have a form that is being used by a user, and the form is writing to an sql database, but it gets the "string or binary data would be truncated, the statement has been terminated" error. I realize that this is due to the fact that he filled out a an entry where the respective column length was shorter than what he put in...
I am curious as to how you account for this? What is the industry practice? Is it better to truncate? Make the database columns a huge size? Put in validators for every single control to make sure that the space is an acceptable length? How do you guys account for things that might go wrong when writing to SQL?
Try, Get's?
I am confused as to how to even approach this sort of thing...
I'm pretty new to SQL and I'm having trouble with a function, probably just syntax. I'm trying to consolidate several rows of data into a single row text field. The calling program can use views but not functions so I need to get a table into a view with the consolidated lines.
Also, I would think this could be consolidated to a single view that calls one function. Is that possible, how would I do it?
Thanks for any help, Steve
VIEW WHERE DATA COMES FROM: CUST_ORDER_ID | LINE_TEXT number1 | first line item text number1 | Second line item text number1 | Third line item text number2 | first line item text number2 | Second line item text ...
VIEW I WANT: CUST_ORDER_ID | CO_LINES_TEXT number1 | Second line item text 'crlf' Third Line item text number2 | Second line item text
FUNCTION CODE: This is the function code with errors
CREATE FUNCTION dbo.tvf_NC_CO_LINES_TEXT (@ORDER_ID VARCHAR(20))
RETURNS @NC_CO_LINES TABLE ( CUST_ORDER_ID VARCHAR(20) PRIMARY KEY NOT NULL, CO_LINES_TEXT VARCHAR(1000) NULL ) AS BEGIN DECLARE @COLinesString VARCHAR(1000); SET @ORDER_ID = CUST_ORDER_ID; SELECT @COLinesString = COALESCE(@COLinesString + Char(13) + Char(10), '') + LINE_STRING FROM NC_CO_LINES_STRING WHERE NC_CO_LINES_STRING.CUST_ORDER_ID = @ORDER_ID SET @COLinesString = CO_LINES_TEXT RETURN END;
GO
ERROR MESSAGES: Msg 207, Level 16, State 1, Procedure tvf_NC_CO_LINES_TEXT, Line 16 Invalid column name 'CUST_ORDER_ID'. Msg 207, Level 16, State 1, Procedure tvf_NC_CO_LINES_TEXT, Line 20 Invalid column name 'CO_LINES_TEXT'.
VIEW CODE: SELECT dbo.CUST_ORDER_LINE.CUST_ORDER_ID, CAST(CAST(dbo.CUST_ORDER_LINE.ORDER_QTY AS INT) AS VARCHAR(2)) + ' ' + dbo.CUST_ORDER_LINE.PART_ID + ' ' + dbo.PART.DESCRIPTION AS LINE_STRING FROM dbo.CUST_ORDER_LINE INNER JOIN dbo.PART ON dbo.CUST_ORDER_LINE.PART_ID = dbo.PART.ID WHERE (dbo.CUST_ORDER_LINE.LINE_NO > 1)
I am importing some data from my IBM DB2 Z/OS mainframe to SQL Server 2005 using the SSIS import wizard. The wizard automatically converted the DB2 string data before trying to store it to SQL Server. The code page that the wizard chose to do its conversion is the 1252 Ansi Latin. However, I am getting the following error on the address field...."one or more characters had no match in the target code page". Can someone suggest another code page? ASCII? IBM 37?
Hi All, we have a set of packages which has to to be implemented across differnet environments. the packages invariable uses OLEDB Source/Destination Components. In these two components the Code Page Property is not Configurable. so if the package has to be Deployed in a different environment than,where it is Developed it gives a Validation Error. Is there a Workaround for this problem. if anybody have faced the problem earlier,please post it. thanks in advance. cheers srikanth
I created some custom code that will check to see if a file exists on a Windows Share.
Code Snippet Public Function FileExists(ByVal FileFullPath As String) As Boolean Try Dim f As New System.IO.FileInfo(FileFullPath) Return f.Exists Catch e As Exception Return e.Description End Try End Function
Code SnippetSystem.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.IO.FileInfo..ctor(String fileName) at ReportExprHostImpl.CustomCodeProxy.FileExists(String FileFullPath) The action that failed was: Demand The type of the first permission that failed was: System.Security.Permissions.FileIOPermission The Zone of the assembly that failed was: MyComputer
Hi all, if have problem to display error message in vb.net that comes from a stored procedure. IF ...... then msgbox "ERROR at Update" returnvalue = SUCCES ELSE Msgbox "Successfull Updated" returnvalue = ERROREND IFHow can I return values from Stored Procedure to VB.NET and then give to User a Message that the Update was successful or not.Thanks to all
"Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
so I tried doing the following
SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
pSql.Assert();
and then I get this error
"Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
we have automated build on every night. In our solution is SSIS project, where each package is encrypted per password. We call build process per command line like this..
C:ProgrammeMicrosoft Visual Studio 8Common7IDEdevenv.exe (c:DevelopmentX3\X3.sln /build Release)' in 'c:DevelopmentProjectsDailyBuild
Through build process we get a error:
External Program Failed: C:ProgrammeMicrosoft Visual Studio 8Common7IDEdevenv.exe (return code was 1):
We think a reason is, that on build of SSIS project must be entered a password. You can wonder for what we need that SSIS packages are part of our build. We hope that on build process is also created Deployment Utility, if so set in dtproject.user. Is it so? Is there any way to create Deployment utility on automated build process? Can be a password provided pre command line?
I recently updated the datatype of a sproc parameter from bit to tinyint. When I executed the sproc with the updated parameters the sproc appeared to succeed and returned "1 row(s) affected" in the console. However, the update triggered by the sproc did not actually work.
The table column was a bit which only allows 0 or 1 and the sproc was passing a value of 2 so the table was rejecting this value. However, the sproc did not return an error and appeared to return success. So is there a way to configure the database or sproc to return an error message when this type of error occurs?
I have a parent package that calls child packages inside a For Each container. When I debug/run the parent package (from VS), I get the following error message: Warning: The Execution method succeeded, but the number of errors raised (3) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
It appears to be failing while executing the child package. However, the logs (via the "progress" tab) for both the parent package and the child package show no errors other than the one listed above (and that shows in the parent package log). The child package appears to validate completely without error (all components are green and no error messages in the log). I turned on SSIS logging to a text file and see nothing in there either.
If I bump up the MaximumErrorCount in the parent package and in the Execute Package Task that calls the child package to 4 (to go one above the error count indicated in the message above), the whole thing executes sucessfully. I don't want to leave the Max Error Count set like this. Is there something I am missing? For example are there errors that do not get logged by default? I get some warnings, do a certain number of warnings equal an error?
Starwin writes "when i execute DBCC CHECKDB, DBCC CHECKCATALOG I reveived the following error. how to solve it?
Server: Msg 8909, Level 16, State 1, Line 1 Table error: Object ID -2093955965, index ID 711, page ID (3:2530). The PageId in the page header = (34443:343146507). . . . . . . . .
CHECKDB found 0 allocation errors and 1 consistency errors in table '(Object ID -1635188736)' (object ID -1635188736). CHECKDB found 0 allocation errors and 1 consistency errors in table '(Object ID -1600811521)' (object ID -1600811521).
. . . . . . . .
Server: Msg 8909, Level 16, State 1, Line 1 Table error: Object ID -8748568, index ID 50307, page ID (3:2497). The PageId in the page header = (26707:762626875). Server: Msg 8909, Level 16, State 1, Line 1 Table error: Object ID -7615284, index ID 35836, page ID (3:2534). The PageId in the page heade"
Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here: Function Main() on error resume next dim cn, i, rs, sSQL Set cn = CreateObject("ADODB.Connection") cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>" set rs = CreateObject("ADODB.Recordset") set rs = DTSGlobalVariables("SQLstring").value
for i = 1 to rs.RecordCount sSQL = rs.Fields(0).value cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution rs.MoveNext Next
Main = DTSTaskExecResult_Success
End Function
This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)
Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:
public Sub Main()
...
Dts.TaskResult = Dts.Results.Success
End Class
I get the following error when I attempt to compile this:
Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.
I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script: - The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.
- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).
Given this statement:
dim cn, i, rs, sSQL
I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:
This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!
Table 1: AddressBook Fields --> User Name, Address, CountryCode
Table 2: Country Fields --> Country Code, Country Name
Step 1 : I have created a Cube with these two tables using SSAS.
Step 2 : I have created a report in SSRS showing Address list.
The Column in the report are User Name, Address, Country Name
But I have no idea, how to convert this Country Code to Country name.
I am generating the report using the Layout tab. ( Data | Layout | Preview ) Report1.rdl [Design]
Anyone help me to solve this issue. Because, in our project most of the transaction tables have Code and Code description in master table. I need to convert all code into corresponding description in all my reports.
Hello, I'm using ASP.Net to update a table which include a lot of fields may be around 30 fields, I used stored procedure to update these fields. Unfortunatily I had to use a FormView to handle some TextBoxes and RadioButtonLists which are about 30 web controls. I 've built and tested my stored procedure, and it worked successfully thru the SQL Builder.The problem I faced that I have to define the variable in the stored procedure and define it again the code behind againALTER PROCEDURE dbo.UpdateItems ( @eName nvarchar, @ePRN nvarchar, @cID nvarchar, @eCC nvarchar,@sDate nvarchar,@eLOC nvarchar, @eTEL nvarchar, @ePhone nvarchar, @eMobile nvarchar, @q1 bit, @inMDDmn nvarchar, @inMDDyr nvarchar, @inMDDRetIns nvarchar, @outMDDmn nvarchar, @outMDDyr nvarchar, @outMDDRetIns nvarchar, @insNo nvarchar,@q2 bit, @qper2 nvarchar, @qplc2 nvarchar, @q3 bit, @qper3 nvarchar, @qplc3 nvarchar, @q4 bit, @qper4 nvarchar, @pic1 nvarchar, @pic2 nvarchar, @pic3 nvarchar, @esigdt nvarchar, @CCHName nvarchar, @CCHTitle nvarchar, @CCHsigdt nvarchar, @username nvarchar, @levent nvarchar, @eventdate nvarchar, @eventtime nvarchar ) AS UPDATE iTrnsSET eName = @eName, cID = @cID, eCC = @eCC, sDate = @sDate, eLOC = @eLOC, eTel = @eTEL, ePhone = @ePhone, eMobile = @eMobile, q1 = @q1, inMDDmn = @inMDDmn, inMDDyr = @inMDDyr, inMDDRetIns = @inMDDRetIns, outMDDmn = @outMDDmn, outMDDyr = @outMDDyr, outMDDRetIns = @outMDDRetIns, insNo = @insNo, q2 = @q2, qper2 = @qper2, qplc2 = @qplc2, q3 = @q3, qper3 = @qper3, qplc3 = @qplc3, q4 = @q4, qper4 = @qper4, pic1 = @pic1, pic2 = @pic2, pic3 = @pic3, esigdt = @esigdt, CCHName = @CCHName, CCHTitle = @CCHTitle, CCHsigdt = @CCHsigdt, username = @username, levent = @levent, eventdate = @eventdate, eventtime = @eventtime WHERE (ePRN = @ePRN) and the code behind which i have to write will be something like thiscmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@eName", ((TextBox)FormView1.FindControl("TextBox1")).Text);cmd.Parameters.AddWithValue("@ePRN", ((TextBox)FormView1.FindControl("TextBox2")).Text); cmd.Parameters.AddWithValue("@cID", ((TextBox)FormView1.FindControl("TextBox3")).Text);cmd.Parameters.AddWithValue("@eCC", ((TextBox)FormView1.FindControl("TextBox4")).Text); ((TextBox)FormView1.FindControl("TextBox7")).Text = ((TextBox)FormView1.FindControl("TextBox7")).Text + ((TextBox)FormView1.FindControl("TextBox6")).Text + ((TextBox)FormView1.FindControl("TextBox5")).Text;cmd.Parameters.AddWithValue("@sDate", ((TextBox)FormView1.FindControl("TextBox7")).Text); cmd.Parameters.AddWithValue("@eLOC", ((TextBox)FormView1.FindControl("TextBox8")).Text);cmd.Parameters.AddWithValue("@eTel", ((TextBox)FormView1.FindControl("TextBox9")).Text); cmd.Parameters.AddWithValue("@ePhone", ((TextBox)FormView1.FindControl("TextBox10")).Text); cmd.Parameters.AddWithValue("@eMobile", ((TextBox)FormView1.FindControl("TextBox11")).Text); So is there any way to do it better than this way ?? Thank you
I know how to use sql to write a block of sql statements by cutting and pasting the results in to the execution window. Now my question is this... is there a way to create the sql and execute the results. i.e. Automatically cut and paste the results into the execution window and run it?? Something to munch on if your bored. Ideas appreciated.
The common way that we use to delpoy reports in production server is using rsbuild.config file and running the command to execute it. Is this a Microsoft product ? does it have any licensing issue if i need to use this approach in my production environment to deploy the reports?
Hi,I need some help here. I have a SELECT sql statement that will query the table. How do I get the return value from the sql statement to be assigned to a label. Any article talk about this? Thanks geniuses.
Hi, I have two tables called Actcodes and a another table called FundBalances...
The Act codes have the following format..
PlanId int, ClientId int, StartDate datetime, EndDate datetime, ClientActCode char(2) CodeDescription char(15) so based on what the user has selected i am getting the names of each codes
and my fund balance i have the following rows.. PlanId int Participantid int StartDAte datetime, end date datetime, FundId int Loans Act1 char(2) TotAct1 money . Act20 char(2) TotAct20 money and the data is as follows PlanId ParticipantId StartDate EndDate fundId Loans Act1 TotAct1 Act2 totact2 ----- Act20 TotAct20 111 1212 1/1/2008 3/31/2008 15 NULL 01 15.15 02 15.48 20 12.4561 111 1212 1/1/2008 3/31/2008 45 0 01 45.12 02 453.123 20 54.00 so on and so so forth
tht Act1 matches the ClientActCode in the Act.. So is there a way i can get those column in my select which have actCodes present in the Act code table. for in... in my act code table for this plan i have 01,02,03,04,05,06, 09, 15 clientAct codes
so can i get the its respective Acts and Totacts column as Act1, Act, Act3, Act Act5, Act6 based on the ClientAct codes.
I'm trying to add a CASE to my statement, I keep getting a syntax error. Can anyone see the issue? Should this CASE work?
Thanks for your thoughts,
Select tmp.Alternate_Name,dbo.tblClient.Salutation CASE WHEN (tmp.Alternate_Name > '') Then tmp.Alternate_Name As Card_Name Else dbo.tblClient.Salutation AS Card_Name END From dbo.tblClient INNER JOIN dbo.tblCards tmp ON dbo.tblClient.ClientID = tmp.ClientID
Hi there, I have 3 columns that contain the same kind of information and I would like to do a select that would return all the distinct records of all 3 colums. Any help woulb be appreciated. Thanks