.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Annoying SQL exception, probably due to some OO/linq code done wrong

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net

I started working on this "already started" project, and I'm having a really annoying error when trying to execute some interactions with SQL Server 2008:

The server failed to resume the transaction

One of these errors I get in this specific method call:

The aspx.cs Call:


busProcesso openProcess = new busProcesso(pProcessoId);
        if (openProcess.GetDocument() == null)
            //Irrelevant code.
    catch{ //... }

The Business class (relevant part):
public class busProcesso : IbusProcesso
        public Processo vProcesso { get; set; }

        RENDBDataContext db;

        public busProcesso()
            vProcesso = new Processo();

        public busProcesso(decimal pProcessoId)
            db = new RENDBDataContext();
                 vProcesso = db.Processos.SingleOrDefault(x => x.Id == pProcessoId);
            catch (Exception ex)
                throw new Exception(ex.Message, ex);

        public string GetDocument()

View Complete Post

More Related Resource Links

Interop: Get Seamless .NET Exception Logging From COM Clients Without Modifying Your Code


Using .NET objects from ASP can help you gain experience with the .NET Framework before migrating to ASP.NET. Your ASP pages will make use of the new .NET components through COM-callable wrappers (CCW). But how will you handle exceptions? This article fills you in.

Matt Adamson

MSDN Magazine January 2005

Whats wrong with this code, im getting blue line under the createStatus next the switch

Error message: Use of unassigned local variable 'createStatus'
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

Locations in XML Format ... code example ... LINQ ..

Hello Experts ...As i am begienner ..Kindly Help in Finding the Solution ---- i am using a webservice ,api which will return data in XML Formant .. I will pass IP Address in WebService / API . This will return this data ....<Locations>  <Location id="0">     <Ip></Ip>     <Status>OK</Status>     <CountryCode>US</CountryCode>     <CountryName>United States</CountryName>     <RegionCode>06</RegionCode>     <RegionName>California</RegionName>     <City>Mountain View</City>     <ZipPostalCode>94043</ZipPostalCode>     <Latitude>37.4192</Latitude>     <Longitude>-122.057</Longitude>  </Location> </Locations>Problem is I want to Show data  CITY,COUNTRY,STATE in  Label .. Kindly tell me the logic .. how to read data from this XML Format ..How to Match them .. Kindly Provide me the Code , as this XML is generated by API ... Thanks a lot ..

Data from text files, What's wrong with my code?

Hi all, I have uploaded some tab-delimited .txt files on my web site (actually run on my computer, ie localhost, for now), and now I try to retrieve the data from those files. I do this by calling a vb file containg the sub below. Everything works great, except that the sub won't recognise unicode characters. I can split the resulting string using vbnewline and vbtab, but already in the sub in question, the string doesn't understand the Swedish letters åäö, apostrophes and more. Any help would be greatly appreciated! /Pettrer       Shared Function getTextfile(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String Dim strContents As String = "" Dim objReader As StreamReader Try objReader =New StreamReader(FullPath) 'UTF8Encoding? strContents = objReader.ReadToEnd() objReader.Close() ErrInfo = Ex.MessageCatch Ex As Exception End Try Return strContents End Function  

Whats wrong with my ExecuteScalar() Code ? - C#.net - Plz Help !

Hi,I downloaded OracleHelper & i'm using it....Now i want to insert a row into a table named 'Sample'.I have 2 textboxes and when i click on the button i need to insert the values from 2 textboxes into the table & here is my code....OracleHelper.ExecuteNonQuery(connectionString, CommandType.Text,"insert into sample (id,name) values(?id,?name);", new OracleParameter("@id", OracleDbType.Int32, Int32.Parse(TextBox1.Text)), new OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString()));The error i get is,ORA-00911: invalid character and it shows the error is innew OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString())Please guide me !

Linq Ouery / Code / Logic for Finding Best Selling Products

Hello ExpertsPlease do reply as i am a beginner ..This is a table Named Products .. I want to show Best Selling products in a Datalist .. kindly tell me the logic for doing so by providing some examples or code by using LINQ ... Kindly help me .. [ProductId] [int] IDENTITY(1,1) NOT NULL,    [Name] [nvarchar](400) NOT NULL,    [ShortDescription] [nvarchar](max) NOT NULL,    [FullDescription] [nvarchar](max) NOT NULL,    [AdminComment] [nvarchar](max) NOT NULL,    [ProductTypeID] [int] NOT NULL CONSTRAINT [DF_Nop_Product_ProductTypeID]  DEFAULT ((1)),    [TemplateID] [int] NOT NULL,    [ShowOnHomePage] [bit] NOT NULL,    [MetaKeywords] [nvarchar](400) NOT NULL,    [MetaDescription] [nvarchar](4000) NOT NULL,    [MetaTitle] [nvarchar](400) NOT NULL,    [SEName] [nvarchar](100) NOT NULL,    [AllowCustomerReviews] [bit] NOT NULL,    [AllowCustomerRatings] [bit] NOT NULL CONSTRAINT [DF_Nop_Product_AllowCustomerRatings]  DEFAULT ((1)),    [RatingSum] [int] NOT NULL,    [TotalRatingVotes] [int] NOT NULL,    [Published] [bit] NOT NULL,    [Deleted] [bit] NOT NULL,    [CreatedOn] [datetime] NOT NULL,  

Linq query in code behind

Hii would like to figure out this LinqDataSource in code-behind in vb.net<asp:LinqDataSource                 ID="lds" runat="server"                ContextTypeName="dbDataContext"                TableName="vKommentarUnion"                  Select="new(Key, Count() as Count, It as Items)" GroupBy="themen"                 where="isdrin=0"                AutoPage="true" AutoSort="true"            /> I found only samples in C#.How can i figure it out in vb?this does not run, what is wrong? Dim db As New dbDataContext Dim kommentare = From c In db.kommentar _ Group c By c.kursid Into Group _ Select key = c.kursid, count = Group.count, _ Items = From item In Group Select item lv.DataSource = k

Release mode application throws Break instruction exception - code 80000003 when running in WinDbg


Here is the initial output of my program after running it from WinDbg:

CommandLine: "C:\Documents and Settings\Administrator\My Documents\Work\QMI_Test_Tool\QMI_UT_Source\Release\QMI Validation Tool.exe"
Symbol search path is: SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00400000 0048f000  QMI Validation Tool.exe
ModLoad: 7c900000 7c9b2000  ntdll.dll
ModLoad: 79000000 7904a000  C:\WINDOWS\system32\mscoree.dll
ModLoad: 7c800000 7c8f6000  C:\WINDOWS\system32\KERNEL32.dll
ModLoad: 77dd0000 77e6b000  C:\WINDOWS\system32\advapi32.dll
ModLoad: 77e70000 77f03000  C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fe0000 77ff1000  C:\WINDOWS\system32\Secur32.dll
ModLoad: 7c420000 7c4a7000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\MSVCP80.dll
ModLoad: 78130000 781cb000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\MSVCR80.dll
ModLoad: 77c10000 77c68000  C:\WINDOWS\system32\msvcrt.dll
ModLoad: 7c9c0000 7d1d7000  C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77f10000 77f59000  C:\WINDOWS\system32\GDI32.dll
ModLoad: 7e410000 7e4a1000  C:\WINDOWS\system32\USER32.dll
ModLoad: 77f60000 77fd6000  C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 7c4c0000 7c53d000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\m

what is wrong with the below simple code?


in a button click I am trying to display a modal popup window
so in the ,cs side button1_click


But it is not displaying any thing on the button click. What is missing?


<style type="text/css">
              /*Olive; */

KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdbdf Exception code: 0xe0434f4d Fault off


Hi all just am getting this error with KernelBase.dll, what's happening at my application end is that I am using .NET Framework to determine if network connectivity is available, raise an event from underlying dll to inform application when network connectivity is established, or network connectivity is unavailable. Nothing really special here just using standard stuff out of .Net framework here.  Have seen similar incidents with KERNELBASE.dll reported, but no one is really giving out any info on what exception 0xe0434f4d is a code for.  Knowing what the execption would be, would allow me to find a quick workaround to the problem. BizTalk seems to have similar issue with KERNELBASE.dll. 


Additional info that may help is that I am running the .NET application on a Windows 7 machine with less than 100MB of storage space, well below the recommended minimum of 300mb, but am testing the .NET application through it's paces now. It should work if Windows 7 is working.

Below is the extract taken from the Windows application log:-


No return from unmanaged code, methods to catch exception?


I am developing a c# application that needs to calls functions from a c header file. I use

[System.Runtime.InteropServices.DllImport("xxx.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true,SetLastError=true)]
        public static extern Byte xxxx(IntPtr hResourceContext, ushort xxxx, ref structa aaa,ref Result_struct Result, Byte b);

to import the dll method. When I call this method in C#, the application simply exits without throwing an exception or error. I've used similar approach for other methods from the same dll which involves passing nested structs as parameter and they work fine. I would like to know how I can debug the code/ catch errors/exceptions from the unmanaged code.

I tried to include the SetLastError=true during DllImport but it does not help.


What am I doing wrong in this LINQ query


I am retrieving an INT value from the one column in my "Counters" table.  I want to cast it to an int then increment it.  The error thrown states that sHitCounter (note that this is not names as it appears but rather the 's' is for "string) is uninitialized at the "parse..." line.

#region Counters
    public class Counters
        public int hCounter { get; set; }
        public static int HitCounter()
            string sHitcounter;
            int iHitcounter;
            IVA.Classes.DataClasses1DataContext hc = new IVA.Classes.DataClasses1DataContext();
                var hitC = 
                    from Counter in hc.GetTable<IVA.Classes.HitCounter>()
                    select Counter;

                foreach (var Counter in hitC)
                    sHitcounter = Counter.ToString();

                iHitcounter = Int32.Parse(sHitcounter);
                    return (iHitcounter);

    }//Class Counters


What's wrong with this code!?!?


I had a piece of code running that is fundamentally the same as the below except it uses temporary tables instead of nested queries. Is there something wrong with what I am trying to do? The one with temp tables works fine...


select category_a, category_b, count(customer_name) as instances, sum(spend) as spend 
select f.customer_name, category_a, category_b, 
case when category_a = category_b then a.spend else f.spend + j.spend end as spend
select customer_name, category as category_a, evidencedspend as spend
from fac_spendtest c join dim_customer d on c.customer_key = d.customerkey
join dim_product e 

Exporting data that is in wrong code page in SQL Server



I have problem, when tryin to export data from SQL Server 2005 using Integration Services.

Sql Server has collation SQL_Latin1_General_CP1_CI_AS (code page 1252), but the actual data is encoded using code page 1257 (SQL_Latin1_General_CP1257_CI_AS). When I look the data using Management Studio, it is displayed wrongly, but when I convert the string to binary, I can see that bytes are encoded using code page 1257. I'm trying to read this data using SSIS 2005, but extended characters are always handled wrongly.

How should I read this data using SSIS?

My first assumption was changing DefaultCodePage to 1257 in my OLE DB Source component (also AlwaysUseDefaultCodePage to true). But without luck.

Also tried to convert data in my SQL Server query using COLLATE, but didn't work.

Is there something I could do to get it working?



All I see is the asp code, what am I doing wrong?


When I load up a .asp page, I just see the code.  How do I get the page to "run"?

Cheers Daniel.

List Item Update Exception from HRESULT: 0x80040E2F Unexpected query execution failure, error code 3


A thread somewhat simliar to this has been posted before as well, but i just wanted to detail out the issue and circumstances

We have a list with 53 columns and 2600 items(and growing. I know its rubbish, but thats the way it is at the moment). The list was created using SharePoint GUI  on a test server, saved as a template with data, and was then imported to the production environment. I can post the list columns and type if it helps.

Every one in a while, on updating an item, SharePoint throws up the very not so helpful error page with "Exception from HRESULT: 0x80040E2F".

We looked into the logs and found that for each suc error, there was a Database level error logged as well.

The error starts with Unexpected query execution failure, error code 3621. Additional error information from SQL Server is included below. "The statement has been terminated." Query text (if available): "BEGIN TRAN;DECLARE... and runs for many lines so i wont post the entire blurb here.

Each time, the item update is successful, despite this error. The list also has an Item Updated event handler attached to it. Every time the update error occurs, the event handler does not seem to be firing.

Anybody can shed light on what is happening. We have tried exporting the list template to another site and everything seemed to work

Code 3005: An Unhandled Exception has Occurred (ASP.NET 2.0.50727.0)



I am receiving the following error on one of the web servers I support:

Event Type: Warning

Event Source: ASP.NET 2.0.50727.0

Event Category: Web Event

Event ID: 1309

Date: 11/3/2010

Time: 10:59:40 AM

User: N/A

Computer: <removed>


Event Code: 3005

Event Message: An unhandled exception has occurred.

Event time: 11/3/2010 10:59:40 AM

Event Time (UTC): 11/3/2010 10:59:40 AM

Event ID: 0c748a133ea846d99fa35a71b76623e6

Event sequence: 3

Event occurrence: 1

Event detail code: 0

Application Information:

Application domain: /LM/W3SVC/1/Root/<removed>

Trust Level: Full

Application Virtual Path: <removed>

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend