Data Platform Developer Center > Data Platform Development Forums > ADO.NET Data Providers > System.Data.DataRowView does not contain a property with the name '*************'
Ask a questionAsk a question
 

QuestionSystem.Data.DataRowView does not contain a property with the name '*************'

  • Thursday, September 17, 2009 11:13 AMSuthar.Kiran Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

                    I am facing one weird problem in my live application.

    I am using ASP.NET 3.5 (C#) and SQL server 2005, IIS 6.0, Windows Server 2003

     

    I am getting error like

     

    (1)    “System.Data.DataRowView' does not contain a property with the name 'ProductName' ”

    (2)    “System.Data.DataRowView' does not contain a property with the name 'ProductPrice' ”

     

    This type of error comes on different pages and it is weird because said columns in exceptions exists in table are returned from Procedure.

    The same page works fine when we refresh it. So it process that column exists.

     

    I have tried different approaches for database operations but none of them is helping.

    My Connection string is

    connectionString="Data Source=***;Initial Catalog=****;Persist Security Info=True;User ID=***** password=**********;MultipleActiveResultSets=True;Min Pool Size=1;Max Pool Size=550;"

     

    Approach: 1

                    Using one single static connection object all over the application. Connection is opened from Application_BeginRequest() and closed from Application_EndRequest()

    When connection is closed, it is also disposed.

    Connection opening is closing is performed only when there is a request for .aspx page

     

    The method which retrieves data checks that connection is opened or not and if it is not opened than only connection is opened.

     

    Approach: 2

                    Each method is having its own connection object and method itself performs connection open and close operations.

     

    Approach: 3

                    At last I have used Microsoft Application Blocks.

    Mainly I am using SqlHelper .FillDataset() method.

    I am just passing connection string, name of procedure and parameters to it.

    Connection opening and closign and all related operation is performed by Microsoft Application Blocks.

     

    Still I am getting the same problem and it occurs randomly it is not fixed.

    I am really upset due to it. My client is also unhappy due to this problem.

     

    Can anyone suggest what could be the problem?

     

    Earlier I was using view in procedure but l have replaced it with actual tables but it did not help.

     

    I think it is clear that problem is not in C# code but it can be from SQL server side issue. But what is the problem that I can’t understand.

    I have taken SQL trace from server and studied it but I could not find any problem there.

     

    Also application pool is getting recycled frequently so that is also one issue.

    Thanks,

    Kiran Suthar

All Replies

  • Thursday, September 17, 2009 3:37 PMSuthar.Kiran Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am also getting error like "System.ArgumentException: Column 'BrandName' does not belong to table Table"
    and by refreshing page, error goes away.
    Said column exists in table and it is returned by Procedure.


    Is this problem can be from SQL server side and not from c# code ?
  • Tuesday, September 22, 2009 5:07 AMNai-dong Jin - MSFTMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Just based on your description, I'm afraid that I've got different opinions.

    Since you mentioned that you have used profile to trace the SQLSever, and you cannot find any problem, so I suspect that the problem exists on the C# code level.

    In your C# code, are you fill the data into a DataTable and bind it to a data presentation control, right? And here, is the datatable static type or is the datatable be shared in many business blocks? If so, have you cleared the DataTable object everytime you start to fill the data in?

    Since you said the phenomenon occurs randomly and it's hard to repro, but I still suggest you to debug your app, and check the current DataTable object and try to see if the content in that object is from the query you just execute.

    Thanks.
    Microsoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Tuesday, September 22, 2009 7:40 AMSuthar.Kiran Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    In your C# code, are you fill the data into a DataTable and bind it to a data presentation control, right? And here, is the datatable static type or is the datatable be shared in many business blocks? If so, have you cleared the DataTable object everytime you start to fill the data in?

    Since you said the phenomenon occurs randomly and it's hard to repro, but I still suggest you to debug your app, and check the current DataTable object and try to see if the content in that object is from the query you just execute.
    Thanks, for the reply.

    I use data table and Data Set to bind the data. but DATA TABLE AND DATA SET ARE NOT STATIC.
    and before binding, Datatable/ Data Set are initialized.

    I have debugged few times and every time, I was getting proper data. I will try to reproduce the problem.

    It looks that problem may be from SQL configuration or something.
    Can anyone suggest what could be the other possibility ?
  • Friday, October 30, 2009 1:49 PMLKhakhleva Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Anybody tell me please, have you any solution for this problem now? I am also getting such error with such conditions:( I tested my solution in various cases but this error is . Error is vary randomly, vary sometimes and on not one page. Please have you answer?
  • Tuesday, November 03, 2009 11:22 AMVMazurMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I do not see it as SQL Server problem. Based on error message it looks like DataTable goes out of scope. Could be in a case if DataTable stored in Session or Application scope. Debugging might not help in this case, but tracing might do, since it allows to run application and collect the information at same time. Try to add tracing capabilities to the application using Trace class and then analyze created log
    Val Mazur (MVP) http://www.xporttools.net