Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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?
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.


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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

577 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