locked
Dynamic Data Site - Access Database RRS feed

  • Question

  • Hello and thanks for looking this over.
    I've been trying to complete this test site using the Visual Basic Web Tamplete for a "Dynamic Data Site Using ASP.NET" and have yet to figure out exactly what I place as my Dynamic-Data-Context class name as is required per this statement in my Global.asax file:
     
      ' Note: Make sure that you change "YourDataContextType" to the name of the data context
      ' class in your application.
      DefaultModel.RegisterContext(GetType("*HERE*"), New ContextConfiguration() With _                                 {.ScaffoldAllTables = False}) 

    I am using the generic northiwnd.mdb and its Customers table as the data source for the Gridview.  I have tried to use Class View in the IDE to look at the possible classes but that shows zero/no classes.

    This has become very frustrating and I appreciate all help - thanks!

    Glenn 

    Sunday, September 4, 2011 9:21 PM

Answers

  • Hi Glenn,

    Welcome!

    You should add data to the web site, Add new item--->Entity Data Model Wizard or  LINQ to SQL Wizard-->Add Tables in each Template----->Register the date Context

    1. open the Global.asax file.

    2. umcomment the line that contains the DefaultModel.RegisterContext method.

    3.

    Defaultmodel.RegisterContext(GetType(ContextType), 
        New ContextConfiguration() With {.ScaffoldAllTables = True})
    

    **** There are two changes here: The contextType and .ScaffoldAllTables = True.

    You can refer here for detail information: http://msdn.microsoft.com/en-us/library/cc488469.aspx#Y3672

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, September 6, 2011 3:03 AM

All replies

  •    I guess I'm asking "What is a data context class" and "where do I look to find out the name of the one being required *HERE*"  The following is the server reported error:

    There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.

    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.InvalidOperationException: There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.

    Source Error: 

    Line 7:          Dim visibleTables As IList = ASP.global_asax.DefaultModel.VisibleTables
    Line 8:          If visibleTables.Count = 0 Then
    Line 9:              Throw New InvalidOperationException("There are no accessible tables. " &
    Line 10:                 "Make sure that at least one data model is registered in Global.asax " &
    Line 11:                 "and scaffolding is enabled or implement custom pages.")

    Thanks again for your assistance!

    Glenn

    Monday, September 5, 2011 2:59 PM
  • Hi Glenn,

    Welcome!

    You should add data to the web site, Add new item--->Entity Data Model Wizard or  LINQ to SQL Wizard-->Add Tables in each Template----->Register the date Context

    1. open the Global.asax file.

    2. umcomment the line that contains the DefaultModel.RegisterContext method.

    3.

    Defaultmodel.RegisterContext(GetType(ContextType), 
        New ContextConfiguration() With {.ScaffoldAllTables = True})
    

    **** There are two changes here: The contextType and .ScaffoldAllTables = True.

    You can refer here for detail information: http://msdn.microsoft.com/en-us/library/cc488469.aspx#Y3672

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, September 6, 2011 3:03 AM