I have a web page with 5 textboxes (for branch_id, street, city, state, and zip) and a button. When data is entered in the textboxes, the button is clicked and the data is populated in the database. I have the sql INSERT statement ("insert into branch values(:branch_id,
location_type(:street, :city, :state, :zip), staff_nested())") in both the SELECT command and INSERT command. It was originally in just the SELECT command, but I also added into the INSERT command in case I need to do something in the on_insert or on_inserting event. I'm not sure if that would actually work since I click the button to enter.
Anyway, if a duplicate key is entered in branch_id the error "ORA-00001: Unique constraint violated" is raised. I would like to change this and put my own error message, such as "ID is already used, select another." What I have so far is below. I do still get the same message.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Catch ex As OleDbException [code]....
3. Data Access Layer to do the dealing with the database.
Now i have a Contacts page from where i can add a new contact to the database.So to add a New Contact i fill in all the required details and then call a Add Method (residing in the BLL) from the page, which in turn call a Add Method residing in the DAL.this method in the DAL returns the Current Identity of the record which is then return back to the BLL method and finally delivered on the page.this is fine. but what if a get an exception how do i handle it properly because the method in DAL has a return type of int and i dont want to throw another error!! coz other wise i will have to write try catch in almost all the methods.
//something like this public int AddMethod(ContactClass contactObj) { int result = 0;[code]...
rather i want to show the user a user-friendly message which they can easily understand and in the mean while i will send a mail to myself documenting the Error that just occurred.how can i implement my custom exception classes.
I'm a little confused as to what is causing the following error is a very simple application: System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB The code-behind has this:
OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["db_conn_qa"].ConnectionString);
In the Web.Config, the following is present (note the Provider is clearly there):
I am trying to write a webservice that's going to be used through ASP.Net Ajax. In this webservice I have to add exception handling so that in case of any error, I could log them to some central place and then throw.
In my other areas of code (like aspx pages), i have been using a basepage which Overrides System.Web.UI.Page class's OnError by adding a custom event handler. I want to do the same for my webservice as well.
Basically I do not want to decorate each webservice method with a Try Catch block. Instead if there is a clean way like to override the on error method, i want to go for that. Unfortunately the WebService class does not seem to have any functionality for this.
I am using asp.net 3.5 and Oracle Providers for membership and roles. Now, using CreateUserWizard i can make user register here but for storing custom information like First name, last name, address etc. i am using couple of custom oracle tables instead of Oracle Profile Provider. In this case, i am using the USERID field which is of GUID type as primary key. Now, my problem is that i dont know how to draw information from my custom oracle tables for those users who are currently logged in. I have searched a lot in this forum and elsewhere where there are many topics relating to it but i failed to follow any of them. So, i would request you to kindly guide me to solve the issue. Oracle Membership
Table(ORA_ASPNET_USERS) USERID=xxxxxxxxxxxxxxx(some guid value) Username=abc and so on.. My Custom Table(UserProfile): USERID RAW(16), --> referenced to USERID field of ORA_ASPNET_USERS table fname varchar2(20) lname varchar2(20) I've the profiles of username "abc" having some userid stored in Userprofile table So, how can i fetch data from UserProfile table for the user "abc" when he is logged in?
I created a simple data access layer in the dll and reference it in my web app. How can I point the error to the user that his code in this line has an exception. currently, when i input a nonexisting table it will popup an error "invalid object name table_name" and points the my code throw exception inside my dll. I want it to point out to the user code that uses my function that creates an error.
Line 92: Dim ds As DataSet = DAL.Dal.ExecuteDataset("SELECT * FROM table_nam", "DBConnectionString")
public static void Test() { try { OpenConnectionToDatabase(); //Opens a connection to Oracle DB } catch(Exception e) { e.Data.Add("Query:", command.CommandText); throw e; } }
When this code is executed when the Database server is being shutdown and the communication is disrupted, .NET throws the following error: Item has already been added. Key in dictionary: 'Query:' Key being added: 'Query:' at System.Collections.ListDictionaryInternal.Add(Object key, Object value) How can this be?
We are using renderaction provided by MVC futures. We've noticed that HttpExceptions in child action methods are not propagated to the parent action. Even though a fragment has failed, we still see the parent request resulting in a 200, and this throws our error handling for a toss.
I have a weird situation here. Using VS2010 and the MVC2 application template, I'm trying to set up error handling, but it refuses to work... Even with a simple controller throwing an exception in the index:
[Code]....
And <customErrors mode ="On"></customErrors> in the web.config file, MVC breaks into the code and tells me that "Exception was unhandled by user code". The default Error.aspx (static text only) is located in /Views/Shared, and I've even removed the login partial view from the master page.
I have a code which reads from a database and loads all feeds in it. Occassionaly I will get errors when the feeds are not responding. The error is happening on this line of code:
[Code]....
How do I add in a code that if the read above fails, ignore and proceed to next data row in the SQLDataReader ?
I'm creating a custom ASP.Net GridView and I want to be able to alter the __EVENTARGUMENT value but I can't figure out how to capture the returned value on the server side.
I'm creating the ability to have a collapsible representation, so the first level is the standard GridView and I will insert additional rows via JavaScript if they expand the first level row.
My problem is how to create a link on the selecond level rows that posts back with custom data.
I am trying out some code which enables me in creating a page with extension .asp2
The tags included will also be custom, something like:
[code]....
I have done the necessary changes so that ASP.NET identifies the extension. I have also kept a mapping of custom tags and asp.net/html tags with myself. With this I am able to render the page on browser. But how can we do event handling(usually done by page postbacks and code) in such a scenario?
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code
After banging my head because i could find where the exception came for and global.asax didn't get hit i found that it's from server.transfer and is a known bug. The alternative i read about is server.execute.However if i do this then the next page fires multiple javascript exceptions and a gridview i have is breaking of and the rows appear half at the left page corner and half inside the gridview!!
For now i just put a try catch on the server.transfer although the exception will not affect the application even if i don't use try catch. I also see that the exception is happening again even if i put try catch but with different dll: A first chance exception of type 'System.Threading.ThreadAbortException' occurred in App_Web_benglxq1.dll An exception of type 'System.Threading.ThreadAbortException' occurred in App_Web_benglxq1.dll but was not handled in user code Now what on earth is benglxq1.dll i don't know. What i know is that i'm leaving an exception to run and i don't like that. This is the js error when i use server.transfer btw: Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys._Application'.
I'm using ASP.NET Webforms and using stored procedures/ADO.NET for DataAccess. Now he does not want me to hard code validation in stored procedures nor in the code behind, but to catch the constraint exception message and look up the same error message in the database and look for the message that we want to show. I wonder if his design will work or should I explain to him that something is wrong here.
I've run into a problem after installing the 64 bit Oracle client onto my Win 7 x64 dev box. I have installed and configured the oracle client and added a reference to it in my library project and it runs without problems when deployed to a Win 2008 R2 server; however I cannot run it in the built-in VS2010 debugger.
The code throws a BadImageFormatException when the .open() statement is called on the connection object.
I figured out that if I will run it in IIS and move the application out of the default application pool, the error goes away for some reason.
However, I can't do this when I'm running the test project (MSTest) and I the result is that I cannot run unit tests against this code. Yes, I can mock it, but I would really like to understand and eliminate this error. There are several cases where I would like to test against some test data in the database.
As the title says I have a Win 7 64 bit dev machine, Win 2K3 32 bit production box and I run against Oracle 10g which Oracle clients do I need to run? Do I need to run the Oracle 32 and 64 bit clients? And if so what versions?
I need to find a way to connect to the remote Oracle server without a DSN. There are some practical problem for accessing the server using a DSN. I need a way to connect to Oracle server like I connect to SQL Server etc. For example, in SQL server, I can connect directly with server using Servername (IP adress) + Username + Password + DB Name. Any way to connect to the Oracle server like in SQL Server we do ??
I have an Asp.net web application targeting .Net2.0 and my databse is oracle, I used SqlDataSource Control to communicate with oracle database its working fine on my development server, but on my production Oracle is 64 bit so im getting an error like
"<asp:ControlParameter doesnot have a property DbType="Int32"> " i tried with Int64 also but still im getting the same error
following is the markup of sqldatasource i used < asp:SqlDataSource ID="sdsEmployees" runat="server" ConnectionString="User Id=user;pwd=user1;server=prod" ProviderName="System.Data.OracleClient" SelectCommand="GetEmployeeInfo" SelectCommandType="StoredProcedure" OnSelecting="sdsEmployees_OnSelecting"> <SelectParameters> <asp:ControlParameter ControlID="txtNumber" DbType="Int32" /> </SelectParameters> </asp:SqlDataSource>