Problem using a LinQ To SQL datacontext RRS feed

  • General discussion

  • I have created a Linq To Sql entity using the drag and drop method in Visual Studion 2008.  I have then inherited from a base class to provide some standard behaviors. After compiling with no error, I try to use the entity on a test web page, but I get an error that "The type 'Agent' is not mapped as a Table".

    What could be causing this type of error?

    The code generated via drag and drop is:


    "dbo.tblAgent")> _

    Partial Private _QBVendorListID As String


    The error occurs in the following code:

    ReadOnly Property Agents() As System.Data.Linq.Table(Of Agent) Get


    Return Me.GetTable(Of Agent)


    End Property

    The following code does the inheriting from the base class:

    Imports System




    Public Class Agent


    Inherits EntityBase(Of Agent)


    Protected Overrides Sub Validate()


    End Sub





    • Changed type Zhipeng Lee Wednesday, September 23, 2009 1:48 AM
    Thursday, September 17, 2009 1:17 AM

All replies

  • Hi RentAPlace,

    For your case, please check if all properties of the type 'Agent' have been mapped to database columns correctly.

    If the problem still exists, you need to provide us more information about your project. For example, the details of the

    Best regards,
    Charlie Lee

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, September 21, 2009 8:02 AM
  • When you drag tables into the dbml file then the connection is reset.

    If you have defined the connection in the base, then every time you drag a table in, you need to click a white part of the dbml file and set the connection to none in properties.
    Tuesday, September 22, 2009 2:18 PM