Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 15th, 2007, 01:40 PM
Registered User
 
Join Date: Jan 2007
Location: Sopron, Györ-Moson-Sopron megye, Hungary.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strange trouble with ADO.NET

Hi forum members,

I developed a ASP.NET application (a Content Management System) that is online by now. It can be used by around 500 registered users at the same time. There is a feature I implemented which sends me automatic error messages (via e-mail) whenever an error occurs in the application (while a user is working).

Unfortunately I keep getting these strange error messages each having something to do with ADO.NET (I'm running SQL-Server 2000 on a seperate database server).

This is one of the strange error I'm getting:

Code:
SqlCommand-Object: (CommandText=member_select_PrivilegesById)(CommandType=StoredProcedure)(Connection=server=192.168.100.20; uid=bikenet;database=bikenet; Connection Timeout=60; Min Pool Size=10; Max Pool Size=2000)

SqlDataAdapter-Object: (SelectCommand<>null)


Object reference not set to an instance of an object.   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at index_red.DB_Abfrage.ReturnDataTable() in c:\inetpub\wwwroot\index_red\db_abfrage.cs:line 108
   at index_red.DB_Abfrage.ReturnDataTable() in c:\inetpub\wwwroot\index_red\db_abfrage.cs:line 116
   at index_red.UserFuncs.GetUserMode(Int32 member_id) in c:\inetpub\wwwroot\index_red\auxiliaries.cs:line 293
   at index_red.UserFuncs.GetBaseFile(HttpSessionState Session) in c:\inetpub\wwwroot\index_red\auxiliaries.cs:line 333
   at index_red.sa_gebraucht_main.lbtnListe_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\index_red\sa_gebraucht_main.ascx.cs:line 105
   at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain()
The first few lines are inserted by the error handling method just to make sure everything is fine. However my SqlCommand-Object seems to be valid (with a valid connection). Something goes wrong with the SqlDataAdapter.

Another error message I sometimes get is:

Code:
Internal connection fatal error.   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)


or


Code:
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at System.Data.SqlClient.SqlDataReader.InternalClose(Boolean closeReader)
   at System.Data.SqlClient.SqlDataReader.Close()
   at System.Data.SqlClient.SqlConnection.CloseReader()
   at System.Data.SqlClient.SqlConnection.Close()


These error happen around 10 to 20 times a day randomly for random users. I have no idea what's wrong. I can post my database class if you need it.

Regards,

Krisztian
  #2 (permalink)  
Old January 16th, 2007, 03:55 AM
Registered User
 
Join Date: Jan 2007
Location: Sopron, Györ-Moson-Sopron megye, Hungary.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I think that the problem must lie within my DB routine class.

The class is using static methods and static members and I used to call it like this:

            
Code:
DB_Abfrage.InitializeSPCall("bbs_berichte_bloecke_select_insert_update_delete_EntryById");
Code:
            DB_Abfrage.AddParameter("@operation", "insert");
            DB_Abfrage.AddParameter("@bbs_berichte_id", int.Parse(bbs_berichte_id));
            DB_Abfrage.AddParameter("@bbs_blocktype", bbs_blocktype);
            DB_Abfrage.InsertUpdateDeleteQuery(true);


But than I read this on a site:

The Web server does not run a separate copy of your application for each user accessing your web site. Bear this in mind as you read through the rest of this article, because you don't want to code global static variables as if each user has a separate copy of them. For per-user data, use session variables instead. For information on session variables, search the MSDN online help for HttpSessionState. Even though there are multiple HttpApplication instances, there's still no guarantee which of these are shared among which users. Each user accessing the site does not necessarily get his own instance of HttpApplication.

So my question is. Could it be that when the class accesses a static member, the static member is not the same as before or that other users access the same static member and corrupt the data stored in it? Does it make sense to use static member in a class (with ASP.NET) at all?

Until now I rewrote the entire DB class and now it is using session variables instead. I hope this was the problem.
  #3 (permalink)  
Old January 16th, 2007, 11:02 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You might be on to something. Using static members makes sence in an ASP.NET application, but of course - only when appropriate.

If you are using static members as if they are private to one particular session or user, then it will certainly cause you problems. A static member is visible to all instances of the class (or all other code that has access to the class when the member's scope allows it).

Woody Z
http://www.learntoprogramnow.com
  #4 (permalink)  
Old January 16th, 2007, 11:54 AM
Registered User
 
Join Date: Jan 2007
Location: Sopron, Györ-Moson-Sopron megye, Hungary.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why would it make sense to use a static member than? If it's shared among other users but not all of them. All I can think of is a constant static member.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ado.recorset.filter "like" trouble hamid1345 VB Databases Basics 2 April 14th, 2017 03:21 PM
Difference between ADO and ADO.NET rakeshclose2u ADO.NET 2 April 23rd, 2007 03:57 AM
ADO AND ADO.NET royalsurej ADO.NET 1 November 8th, 2004 07:28 AM
VERY strange problem with VB6 and .net WebService vertigo Pro VB 6 0 June 7th, 2004 06:04 AM
MSDE and SQL CE (using VB.NET and ADO.NET) LEGS ADO.NET 0 July 12th, 2003 11:27 AM



All times are GMT -4. The time now is 11:46 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.