Why can't I use reference a TableAdaptor that I've created.

Robert Barnes 101 Reputation points
2023-04-07T05:16:18.8533333+00:00

I am trying to write a simple ASP.NET application to send out a newsletter, using data from a SQL Server database. To access the database I created a tableadaptor in object Group.xss. This .xss (data designer) window looks as I would expect. I have tested this table adaptor from this window. it is connected to the (remote) database and returns exactly the three records that it is supposed to in my initial test. I then returned to my ASP.NET page and tried to define the table adaptor with my usual template of defining the Table Adaptor, Table, and Row with statements like this

    Dim taGroupAdmin As New GroupTableAdaptors.GroupAdminsTableAdapter   '  Used for Test emails
    Dim tbGroupadmin As Group.GroupAdminsDataTable = Nothing
    Dim trGroupAdmin As Group.GroupAdminsRow

intending to use later code to fill the table and process its rows. However I can't get past the definition of taGroupAdmin. With the other two statements commented out leaving only Dim taGroupAdmin ... The Dim statement gives error: - GroupTableAdaptors.GroupAdminsTableAdapter' is not defined and there is also a message from Group.xss (line 1): - Custom tool error: The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security This is on my own PC, for which I am the admin. I tried to find the answer from the internet, the examples talked of setting a registry key setting for "MyApp". Would my equivalent of MyApp be the name of my program ("Default"), the name of the .xss object ("Group"), or something else. I'm using Visual Studio 2019, and SQL Server 15.0.2000. Thank you, Robert Barnes

Developer technologies | ASP.NET | Other
SQL Server | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 30,206 Reputation points Microsoft External Staff
    2023-04-07T09:22:23.6766667+00:00

    Hi @Robert Barnes, You need to initialize. You can refer to my code below, I did a simple test with gridview.

    Dim a As Group = New Group()
            Dim taGroupAdmin As GroupTableAdapters.GroupAdminsTableAdapter = New GroupTableAdapters.GroupAdminsTableAdapter()
            Dim itemRow As Group.GroupAdminsRow = taGroupAdmin.GetData(0)
    
            Dim dt As DataTable = New DataTable()
            dt = taGroupAdmin.GetData()
            GridView1.DataSource = dt
            GridView1.DataBind()
    

    User's image

    User's image

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.