Raising User Friendly Message In Case Of DB Error
Oct 20, 2007
Hi,I am using sql server 2005 and i am having table with a column which has unique key constraint.So if the user tries to enter the duplicate value for that particular column and try to save it ,it errors out in runtime..how do i raise the user friendly error message in this DB error, when user tries to save it.Thanks
View 9 Replies
ADVERTISEMENT
Apr 9, 2007
Hi all,
I was wondering whether there is a way to show the user an error when the user did not select a specific parameter.
In my case, I have two optional parameters. The user has to select either one to view the report. If the user does not select either one, I would like to show some sort of an error page indicating so. However, all i am getting is a complete blank with no report in sight. I as a developer know this is an error as a result of missing parameters, but i was wondering whether I could produce a page or direct it to a page so that the user doesn't go all horrified at an empty page ?
Thanks
Bernard
View 4 Replies
View Related
May 14, 2007
The notorious situation: a duplicate key exception. Users register themselves using fancy nicknames.This often leads to conflicts. In addition, as I point out in error reporting -- to except or not expect or return, the conflicts can not be prevented in a distributed environment (one ensures that there in no such name and still can get a concurrent conflict). For these reasons, the apps should be prepared to the conflicts. The cases to which apps are prepared, are not exceptional.
Meantime, if the engine insert process fails things naturally, we get an exception with a message like "Violation of UNIQUE KEY constraint 'col_name'. Cannot insert duplicate key in object 'table_name'. At first, it is not quite informative. Customers prefer to see something like: "a user with such a name already exists". Additionally, as explained in the referred topic, exception processing is extremely CPU consuming and should be not normally used as a function "feedback" tool.
The option to prevent the exception raising by preceding the INSERT op by a table-locking SELECT is not attractive either because of 1) locking and 2) double checking. Obviously, we get the conflict exception on INSERT because the DB engine precedes the insertion by a select. How it would check the existence of the same key in the table otherwise? I want to say that the only thing we should do is to override the default DB error handler.
How do I know that the error was caused by some specified constraint violation letting other issues to fail naturally? Should I parse the exception message looking for key_name?
View 5 Replies
View Related
Apr 24, 2015
Is there a way to display a friendly message if a sub-report does not have content ex "No additional products available"...
View 2 Replies
View Related
Jul 23, 2005
I feel like I'm missing something obvious here, but I'm stumped...I have a stored procedure with code that looks like:INSERT INTO MyTableA ( ...fields... ) VALUES (...values...)IF (@@ERROR <> 0)BEGINROLLBACK TRANSACTION;RAISERROR('An error occurred in the stored proc.', 16, 1);RETURN(1);END--FORCING AN ERROR AT THE END FOR TESTING PURPOSESRAISERROR('Proc Successful',16,1)On MyTableA, there is a trigger that loops through the inserted data andstops the insert in certain circumstances, returning an error:IF (some criteria)BEGINROLLBACKRAISERROR('An error occurred in the trigger.',16,1)RETURNENDWhen I call the stored procedure from VB (connecting via RDO) witherror-causing data, the trigger successfully stops the insert, and adds thetrigger-error-msg to the errors collection, but it does NOT seem to createan error situation back in the stored procedure. The procedure finishes upwith the "Proc Successful" message, so that when I iterate through theerrors collection back in VB, I have "Proc Successful" followed by "An erroroccurred in the trigger."Is there some way I'm not finding to have the calling procedure recognizethat a raiserror occurred in the trigger and behave appropriately for anerror situation?Jen
View 1 Replies
View Related
Dec 12, 2007
Can anyone give a quick description of the meaning of this message andwhat needs to be done to get a connection.I'm running DBArtisan with SQLServer 2000 client SP4 installed.I also get the same message with MS Enterprise Manager so this iscoming out of the actual ODBC connection attempt.Thanks in advance!
View 1 Replies
View Related
Mar 4, 2008
how can i make a customized error message for a wrong input of parameters?
let's say i have a parameter which requires user input of companyID and it should compose of all numbers only. if not followed an error message will be prompted to the user... "please enter numbers only..." or something like that...
please... just wondering if its possible...
View 2 Replies
View Related
Aug 29, 2006
Ok so I'm using the Management Studio Express and was able to log in and get into the database server, but I had to click the "options>>" button and change database I wanted to connect to from <<default>> to my database on the server or else I get the "cannot open user database, login failed" error message.Then I right click my database and it gives me the "Cannot open user database. Login failed" error message, even though I already connected to the database to login during the connect screen. Also I'm able to interact with the database using SQL QUERIES in the Management Studio, like adding new tables with it, but if I right click the database and click "add table" I get that error.What gives? I know I have permission since I was able to log on, and modify the database using SQL queries but if use the GUI I can't use it. I can't even right-click select "properties" without getting that error. The reason I want to use the GUI is because I want to right click and use the backup feature of the database.My guess is that Management Studio continues to point to the default database(which gives me that message) after I already logged in, so I have no idea how to change the default database that management studio points to, to the one I do have permission to use. Thanks in advance.
View 1 Replies
View Related
Sep 28, 2015
I've been quite excited about SQL Server MDS that should allow non-IT staff to easily maintain data. However maintaining data that have many-to-many relationships seems to be quite a pain. I believe the best way is:
Open up your MDS web interfaceGo to entities > product (for example)Add a new member and fill the details Click "product parts" in the bottom right "Related Entities" partAdd a new memberTry and find the product you just created from the dropdownlistSelect the first part and click OKAgain try and find the product you have created from the dropdownlistSelect the second part and click OKRepeat...Close the tab on your browser and finish your product entity.How I wish it worked:
Open up your MDS web interfaceGo to entities > product (for example)Add a new member and fill the detailsCheck a checkbox for each part visible under "product parts" in the bottom right "Related Entities" partFinish your product entity.
View 3 Replies
View Related
Jul 11, 2007
I want to list out the pending transaction for transaction replication by publication.
Help needed.
View 1 Replies
View Related
Aug 8, 2006
I would like to password protect my MS Access Database which is being exported to from SQL 2000 using DTS, but when I password protect it, I get an error message stating "The workgroup information file is missing or opened exclusively by another user". The ACCESS file has to be opened exclusively to add password protection. Any suggestions?
View 1 Replies
View Related
Mar 3, 2008
Hello everybody,I was configuring a SqlDataSource control using SQL Authentication mode.I first added a database file (testdb.mdf) through Solution Explorer-Add New Items. Then through Database Explorer I created a table named "info"Then while configuring the SqlDataSource control I used the SQL Authentication mode and attached the "testdb.mdf" database file.Test Connection showed success. But when I hit the Ok button of the wizard it displayed the following error message:Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance.While configuring the SqlDataSource control I clicked "New Connection". Under Data Source section I tried both Microsoft SQL Server and Microsoft SQL Server Database File. And in both the cases I attached a databese file(testdb.mdf). Plz enlighten me on this.Thanks and Regards,Sankar.
View 1 Replies
View Related
Sep 6, 2007
I am working on a C#/asp.net web application. The application has a text box that allows a user to enter a name. The name is then saved to the database.
Before the name is saved to the database, I need to be able to check if the name already exists in the database. The problem here is that what if the name is in the database as "JoE ScMedLap" and somoene enters the name as "Joe Schmedlap" which already exists in the database,but just differs in case.
In other words how do deal with case sensitiviy issues.
View 2 Replies
View Related
Oct 23, 2007
I want to raise the custom success message after insert and update something like say 5 records updated successfully or inserted successfully?Is there a way i can do that in stored procedure?Also,can someone enlighten me on 'ReturnValue' part of [ ParameterDirection.ReturnValue;]here.
I am coding in c# ,(sql server 2005)and my insert and update codes are in DAL,which gets called from BLL like this. public int updateRecord(int data1, string text1, string text2, bool ind, string sproc,Label lblErr) {
using (SqlConnection fbConnect = new SqlConnection(appProperty.dbconnect))
{
SqlCommand fbCmd = new SqlCommand(sproc, fbConnect);
fbCmd.CommandType = CommandType.StoredProcedure;
..... parameter stuff......
SqlParameter val = fbCmd.Parameters.Add(new SqlParameter("@ReturnValue", SqlDbType.Int));
val.Direction = ParameterDirection.ReturnValue;
try{
fbConnect.Open();
fbCmd.ExecuteNonQuery();}
catch(Exception ex){lblErr.Text = ex.Message}
int iSuccess = (int)fbCmd.Parameters["@ReturnValue"].Value;//I am NOT using this effectively.How can i make use of it?
return iSuccess;
}
}
View 3 Replies
View Related
Feb 8, 2006
Hi,
I am building a custom component. In the Validate() method I am checking for various things. Here's a section of my code:
if (ComponentMetaData.InputCollection[0].InputColumnCollection.Count != 1)
{
return DTSValidationStatus.VS_ISBROKEN;
throw new Exception("You need to select one and only one column");
}
The problem I'm finding is that my Exception never gets thrown so I never see the error in the UI. if I reverse the 2 lines like so:
if (ComponentMetaData.InputCollection[0].InputColumnCollection.Count != 1)
{
throw new Exception("You need to select one and only one column");
return DTSValidationStatus.VS_ISBROKEN;
}
Then I get my error message in the UI but I never get anything returned from my Validate() method - which doesn't seem quite right to me.
I don't like using FireError() either because it merely puts the error into the Task list window - and who ever looks at the Task list window???
I'm basically just after some guidance about what people think is the "proper" way of doing this. At the moment I prefer to throw an exception because that way I get some errors in the UI.
Regards
Jamie
View 6 Replies
View Related
May 3, 2006
When a catchable error occurs in a try block, control is passed to theassociated catch block. While I am then able to examine properties ofthe error using such functions as ERROR_NUMBER() in the catch block,the error-logging scheme used in my company requires that the actualerror be raised so that it can be picked up by components in the nexttier. I appear to be unable to do that -- I can raise some other errorthat has all of the properties of the original except the error number.For example, division by zero raises error 8134. If the code thatproduces that error is enclosed in a try block, I seem to be unable toraise that error from the catch block. Of course, if I never used thetry block to begin with this wouldn't be a problem, but then wewouldn't have the advantages of this structure as it applies to othererrors, some of which we may wish to handle differently. WhileTry-Catch looks great as a way of allowing us to handle errors in acustomized way and to avoid having all errors be passed up to ourmiddle tier, it seems that we are unable to pass ANY such errorsforward, and that is a problem for us, too. Is my understanding ofthis situation correct, or is there some way around this problem, e.g.,is there any way I could have raised error 8134, in the above example?Thanks.
View 2 Replies
View Related
Oct 11, 2005
Is there a way I can stop a script task of a control flow from raising OnError Events? or Is there a way I can Set Dts.Results to Fail without having the script task raise OnError event.
View 8 Replies
View Related
Sep 23, 2006
Do you know a stored procedure ( or a query) to send a message to a SQLServer user ?
Something like NET SEND but with a spid user
Thanks
View 4 Replies
View Related
Jan 14, 2004
I am having a problem getting informational type messages to display for my end users.
I have a SQL2000 db with a Delfi front end. When I issue either the raiserror or print nothing is displayed inside the app. With raiserror I can get it to display if I make the severity higher than 10. The problem with this is that it stops the app from processing the transaction. This is ok in one case but not with just informational type stuff. Any suggestions? Thanks.
Jim
View 1 Replies
View Related
Sep 7, 2007
Hi -
I have an File System Task that copies a file from one directory ot another. When I hard code the target directory (c:dirfile.txt) it works fine. When I change it to a virtual directory (\serverdirfile.txt) I get a security error:
[File System Task] Error: An error occurred with the following error message: "Access to the path '\gracehbtest oS2TMM_Live_Title_000002.xml' is denied.".
Where do I change the security settings?
Thanks - Grace
View 5 Replies
View Related
Jul 20, 2005
I am new to SQL server and I am looking for the best practiceregarding the following:The GUI for the database I am creating has a number of questions like:A. Where are you currently living?1) In my own home2) In the home of a family member3) In a shelter4) On the streetHowever, for speed of data entry, the GUI (it's a web front-end,ASP/VBScript) accepts the number only. Futhermore the database onlystores the number entered.So for example for the above question, when the user is doing the dataentry, they would just enter a 1, 2, 3, or 4.However, when viewing the data, the end user wants to see the textthat corresponds to the number. So for example, if the user entered"3" for the above question, when they are viewing the data in the GUI(not to make edits, just viewing), they want to see "(3) In ashelter".My question is how best to display these friendly values?Should I do all the conversions in a stored procedure? If so, whatwould be the best way to do that? I tried something like this:SELECT Current_living =CASE Current_livingWHEN 1 THEN '(1) In my own home with my partner'WHEN 2 THEN '(2) In the home of a family member'ELSE NULLENDFROM tbl_DemographicInfo WHERE ClientID = @ClientIDbut I can't figure out how to do this for multiple fields.ALSO, I'm not sure if burying this stuff in a stored proc is the wayto go, because if the client wants a slight change to the friendlyname I have to get into the SP and change it. Seems like there mustbe a better way.I can also do this in the ASP code, but that also doesn't seem likethe best practice.I can have a lookup table, but again, where do I do the conversion?In an SP? With a view?Again, I'm looking for the best practice here. I know some ways Icould do it (like in the ASP), but I want to do it efficiently andcorrectly.Any help/comments are greatly appreciated.thanks in advance,Jon LaRosajlarosa at alumni dot brown dot edu
View 2 Replies
View Related
Aug 29, 2007
Hi,
I have added interactive sort to report. When i perform the sort in the preview of the report, i see a message 'Report is being generated'. But when i do the sorting from Report viewer control, the screen goes blank before the sorted data comes up.
Is there any way I can display a message telling sorting is in progress?
Any help in this regard is appreciated.
Thanks.
View 3 Replies
View Related
Aug 18, 2006
I'm trying to use an XML Task to do a simple XSLT operation, but it fails with this error message:
[XML Task] Error: An error occurred with the following error message: "There are multiple root elements. Line 5, position 2.".
The source XML file validates fine and I've successfully used it as the XML Source in a data flow task to load some SQL Server tables. It has very few line breaks, so the first 5 lines are pretty long: almost 4000 characters, including 34 start-tags, 19 end-tags, and 2 empty element tags. Here's the very beginning of it:
<?xml version="1.0" encoding="UTF-8"?>
<ESDU releaselevel="2006-02" createdate="26 May 2006"><package id="1" title="_standard" shorttitle="_standard" filename="pk_stan" supplementdate="01/05/2005" supplementlevel="1"><abstract><![CDATA[This package contains the standard ESDU Series.]]></abstract>
There is only 1 ESDU root element and only 1 package element.
Of course, the XSLT stylesheet is also an XML document in its own right. I specify it directly in the XML Task:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:template name="identity" match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="kw">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="ihs_cats_seq" select="position()"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Its 5th line is the first xsl:template element.
What is going on here? I do not see multiple root elements in either the XML document or the XSLT stylesheet.
Thanks!
View 5 Replies
View Related
May 25, 2006
I have a stored procedure that returns a set of tables based on data in a table for a company. These tables are being used to create drop down lists for criteria selection for the client. We have a Javascript based control that will make use of these based on the control name. So... ideally, I would like the stored procedure to return tables named "EmployeeID", "ResourceName", so that I can accurately name the controls when they are being created. The data that is returned is not static, so, for example, client 1 may see the EmployeeID drop down, while client 2 may not.
I searched and didnt see anyone that was able to accomplish this in this way, but wanted to post something here before I moved forward in a different direction.
I am thinking that I will likely return an extra table with the field names and their corresponding tables (i.e. "EmployeeID"/"Table0", "ResourceName"/"Table1", etc...)
Thanks,
Josh
View 2 Replies
View Related
Oct 5, 2007
Hi experts,
What I am trying to do is to open an existing report in a Print Friendly format .
What is the simplest way to do this using Visual Studio?
Here's the sort of thing I hope is feasible:
I can open my Report on a web page , then on that page can be a button / link for the user in case they want to open
that report in a separate window.
So I'd like to jump to that page by jumping to an URL and sending all parameters
something like :
http://Dev_Server/Reports/Pages/Report.aspx?ItemPath=%2fMy+Reports%2fTest+Report&rsaramOne=Parameters!paramOne.value + paramTwo=Parameters!paramTwo.value + etc all other parameters , I have on that report
Any suggestions would be really appreciated .
Regards,TIA
View 3 Replies
View Related
Jul 23, 2005
I keep getting an error message "incorrect syntax near keyword case"when trying to run this:USE DEDUPEGOCREATE FUNCTION fnCleanString(@mString varchar (255))RETURNS varchar(255)ASBEGINDECLARE@mChar char(1),@msTemp varchar(255),@miLen int,@i int,@iAsc intBEGINset @mChar = ''set @msTemp = ''set @miLen = Len(@mString)set @i = 1while @i <= @miLenbeginset @mChar = substring(@mString,@i,1)set @iAsc = Ascii(@mChar)casewhen @iAsc >= 87 And iAsc <= 122 Then set @mChar = @mCharwhen iAsc >= 65 And iAsc <= 90 Then set @mChar = @mCharwhen iAsc >= 49 And iAsc <= 57 Then set @mChar = @mCharelse @mChar = ""endset @msTemp = @msTemp & @mCharset @i = @i + 1endENDRETURN @msTempENDCan anybody point out what I'm doing wrong?Thanks.Randy
View 3 Replies
View Related
Apr 26, 2008
Hi all,
I have a SSIS package that copies data from one database, into another, makes a backup, and then FTP's up the backup to a web server. In Sql Server I've made a job to run the package and a Stored procedure to activate the job from an Access database front-end.
Can anyone tell me how I might return a success/failure message to my access user?
Thanks
Melt
View 2 Replies
View Related
May 30, 2007
Hi, all experts here,
Thank you very much for your kind attention.
I am trying to create a new mining structure with case table and nested table, the case table (fact table) has alread defined the relationships with the nested table(dimension table), and I can see their relationship from the data source view. But why the wizard for creating the new mining structure showed that message? Why is that? And what could I try to fix it?
Hope it is clear for your help.
Thanks a lot for your kind advices and I am looking forward to hearing from you shortly.
With best regards,
Yours sincerely,
View 4 Replies
View Related
Apr 13, 2008
I just started playing with sqlagent and am finding that viewing a specific message from an ssis step is cumbersome when other entries are also in the log. Exporting seems only able to export all history entries. Viewing right in the log viewer leads to a series of boundary expansions and right scrolls that dont seem convenient for quick identification of a problem in a medium sized ssis message. Right clicking on the message in the viewer seems like it is preparing the message for possible copy but it seems to end there. I'm already familiar with the different levels of verbosity available in the command line. Dont see anything useful on the web.
Is there a user friendly way to copy the contents of a specific message for perhaps pasting to notepad , so that problem identification is facilitated? Is there a not so user friendly way available, one taht doest involve 1st exporting the entire log?
View 7 Replies
View Related
Aug 31, 2006
Hi, I have created a login page (webform1) that enables me to enter my user number and password and if correct it re-directs to webform 2 where all data related to the usernumber that was entered in the login page, appears. Now I want to be able to set different re-direct pages dependant upon different users as some may require more privileges then others. As for my query I have 2 types of users: staff and managers. I want to set the login page so that if staff logins in it goes webform 3 and if manager logins in it goes webform 4. My table in the Sql database is called Users & the fields are: unumber(pk), pwd, userRole, forename, surname. I have been advised to use CASE statements, yet I do not know how to use them. Below have left my code of a simple login without the userRole validation. Please help! Sub cmdLogin_ServerClick If ValidateUser(txtUserNumber.Value, txtUserPass.Value) Then Dim tkt As FormsAuthenticationTicket Dim cookiestr As String Dim ck As HttpCookie tkt = New FormsAuthenticationTicket(1, txtUserNumber.Value, DateTime.Now(), _ DateTime.Now.AddMinutes(30), chkPersistCookie.Checked, "your custom data") cookiestr = FormsAuthentication.Encrypt(tkt) ck = New HttpCookie(FormsAuthentication.FormsCookieName(), cookiestr) If (chkPersistCookie.Checked) Then ck.Expires = tkt.Expiration ck.Path = FormsAuthentication.FormsCookiePath() Response.Cookies.Add(ck) Dim strRedirect As String strRedirect = Request("ReturnURL") If strRedirect <> "" Then Response.Redirect(strRedirect, True) Else strRedirect = "webform1.aspx" Response.Redirect(strRedirect, True) End If Else Response.Redirect("webform3.aspx", True) End If End Sub
View 1 Replies
View Related
Aug 24, 2006
Hi,
I'm wondering, why CLR user-defined-types are case-sensitive in T-SQL?
When I create an udt with vb.net, e.g. udtPoint with properties X and Y and a method ToString(), I have to write udtPoint.X ..., udtPoint.x would raise an error. udtPoint.tostring() isn't working, too.
I like vb, because you don't have to remember whether syntax is upper or lower case. Same is with T-SQL, there's no difference between select * from table and Select * FROM Table. Intellisense would by great, but is not yet implemented .
I'd like to put this topic under suggestions (in my opinon it's a bug), what do you think about it?
Many thanks for your answers!
View 1 Replies
View Related
Apr 10, 2006
Hi Im getting the following error when trying to connect to a php page...any ideas
message: Login failed for user 'NT AUTHORITYNETWORK SERVICE'. (severity 14)
View 1 Replies
View Related
Jul 27, 2006
I notice when I copy an SSIS package 'A' to a new package 'B', the new package 'B' will generate a "login failed for user" message in the data flow components. To copy I "save copy of Package 'A' as."
Some config info:
Package ProtectionLevel = EncryptSensitiveWithPassword
Connections are Data Sources
Connection strings with password are stored using PackageConfigurations to an SQLServer table. I've verified Package 'A' is in fact using the config table (e.g. it is not using a password or user stored in the package)
Data connectios are all SQLServer Native OLE DB Client
The account is an SQLServer account (not integrated security)
The original Package 'A' works flawlessly and I get success when I test the connections in Package 'B'.
But executing package 'B' I get: The error message I get is: [Connection manager "MyConnection"] Error: An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E4D Description: "Login failed for user 'dwuser'.".
Does anyone know why this would occur and/or how to work around it? I saw another thread where a potential workaround is to create a new data flow task and copy all the data flow components to that task. That won't work well for us because the data flow is moderately complex and when you copy and paste it, SSIS completely re-orders the layout.
This is a typical data warehouse ETL setup where there is a master package that executes child packages (e.g. 'A', and 'B' mentioned above) that each perform the ETL for a specific dimension or fact table.
Thanks for any help,
Lee Cascio
View 3 Replies
View Related