Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Error databinding when multiple user access site

Posted on 2011-09-29
Medium Priority
Last Modified: 2012-05-12
I have a website developed in VS2010 that in published on a production server and  uses a static instance of a connection string.  When multiple users try to use the site at the same time they recieve Data Binding errors.  It's like the wrong data is being returned or that the gridview is trying to bind to the wrong result set.  I can not reproduce the errors on my local machine.  I have checked the stored procedures and know that they return the correct column names.  If you let the error sit for a couple minutes or restart the program the error will disappear.  Here is how the connection string is written:
public class DBCadView
      public DBCadView(string connectionString)
            _Connection = new SqlConnection(connectionString);
        _DataAdapter = new SqlDataAdapter();
    public static DBCadView Connection
            if (_Instance == null)
                _Instance = new DBCadView(ConfigurationManager.ConnectionStrings["PatternShop10"].ConnectionString);**(set in the webconfig)
            return _Instance;
    public DataTable getCadView()
            SqlCommand command = new SqlCommand("spps_getCadViewData", _Connection);
            command.CommandType = CommandType.StoredProcedure;
            _DataAdapter.SelectCommand = command;
            DataTable result = new DataTable();
            return result;

            return null;
       private SqlDataAdapter _DataAdapter;
    private SqlConnection _Connection;
    private static DBCadView _Instance;

any help or suggestion anyone may have to eliminate these errors would be greatly appreciated.  Thank you for your time
Question by:hscast
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 40

Accepted Solution

Jacques Bourgeois (James Burger) earned 2000 total points
ID: 36817170
What is the exact type of Exception and exact message they receive?


You do not need to Open and Close the connection when you use Fill. Fill will do it automatically for you, and will take care of doing it before triggering an Exception it it happens. You need to Open and Close with a DataReader, when executing a Command object directly or when working in transaction mode. But not with Fill or FillSchema when you are executing them outside of a Transaction.

Since, by default, you can have only one operation running at a time on a connection instance, this also prevents problems should the connection not close properly somewhere.

It is also suggested to use a local variable for the Connection. As long as you use the exact same ConnectionString all the time, the connection pooling built into the SqlConnection object will manage the connection in a better way than you can.

By using the built-in mechanisms of the SqlClient class, you have less chances of a Connection keeping a lock on a table somewhere.

It could correct your problem.

Author Comment

ID: 36817569
1.  DataBinding: 'System.Data.DataRowView' does not contain a property with the name "some column name
2.  Column "some column name" does not belong to table

We are using a link server.  Some of the data is located on a 2000 server and some is located on a 2008 server

Expert Comment

ID: 36817607
How does your connection string look like?
It may be that there are some segment in the connection string that handle the locking problem.
It may also be good to take a look at the Stored Procedure that you get data from. Maybe it could need some kind of tuning?

You may also create the command from the connection instead of with the "new" keyword.
Example :
SqlCommand command = _Connection.CreateCommand();

May I see the exception that you get?
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.


Author Comment

ID: 36817671
Connection String from the web config - <add name="PatternShop10" connectionString="data source=SOYUZ;persist security info=False;user id=userid;password=pword;initial catalog=PatternShop;packet size=4096" />

error msg - DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'fdesc'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'fdesc'.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'fdesc'.]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +8688109
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8
   System.Web.UI.WebControls.ListControl.PerformDataBinding(IEnumerable dataSource) +349
   System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +109
   System.Web.UI.WebControls.ListControl.PerformSelect() +34
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   Websites_RushList_SampleShts_RushListDefault.LoadSearch() +430
   Websites_RushList_SampleShts_RushListDefault.Page_Load(Object sender, EventArgs e) +36
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

LVL 40
ID: 36818994
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'fdesc'.

There is a control in the page that set to display the value of a field "fdesc" and this field is not part of the data fetched from the database by the spps_getCadViewData stored procedure.

You either have an extra control that is useless in the page, or the field "fdesc" was not specifier in the SQL command or stored procedure that is executed when you retrieve the data.

If the information is needed, look at the code in the stored procedure, or ask somebody to do it if you do not have access to it. If the field fdesc is not there, add it to the procedure. Or check that it is not mispelled, either in the procedure or in the part of the application where the binding is defined. The two need to match for binding to work.

Author Closing Comment

ID: 36891680
Ended up setting all the connections local and it works now, Thank you very much for your time

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question