locked
Strongly type dataset issue RRS feed

  • Question

  • Hi All,

    I'm having an issue with a typed dataset that Ive added to my project. For some reason when the code get to the fill command:

     Me.UsersTableAdapter1.Adapter.SelectCommand = dd3  '.CommandText = SqlUsers
    me.UsersTableAdapter1.Connection = OpenConnection
    Me.UsersTableAdapter1.Fill(WA_MMTP_TrackerDataSet1.Users)
    

    I get a "object reference not set to an instance of a object" error.  I but a break point in the dataset Fill code:

     Public Overloads Overridable Function Fill(ByVal dataTable As WA_MMTP_TrackerDataSet1.UsersDataTable) As Integer
    Me.Adapter.SelectCommand = Me.CommandCollection(0)
                If (Me.ClearBeforeFill = true) Then
                    dataTable.Clear
                End If
     Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
     Return returnValue
    End Function
    

    It errors out on the Me.Adapter.Fill(dataTable) line. Why is this happening. A little frustrating since this is a typed dataset generated from VS 2013. Thanks for any help.

    Michael

    Wednesday, April 8, 2015 3:35 PM

All replies

  • Yea but what is Me.Adapter, I don't see it instanced, neither what it is.


    Success
    Cor

    Wednesday, April 8, 2015 4:59 PM
  • Hello Michael,

    As Cor mentions, it is not clear if you have created the instance of your UsersTableAdapter1 object, if possible, please share more detail code with us.

    >> It errors out on the Me.Adapter.Fill(dataTable) line

    There is a way you could use it to determine which object is null, when you debug this line, you could put the cursor over an object, the Visual Studio intellisense would shows us Nothing in VB if this object is not instanced:

    Here is a sample I created to call the Fill method which does not use the Me keyword:

    Dim dt As DataSet1.OrderDataTable = New DataSet1.OrderDataTable
    
    Dim da As DataSet1TableAdapters.OrderTableAdapter = New DataSet1TableAdapters.OrderTableAdapter
    
    da.Fill(dt) 
    

    All objects are generated automatically when creating the typed dataset. Please have a try this way.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Cor Ligthert Thursday, April 9, 2015 11:36 AM
    Thursday, April 9, 2015 2:29 AM
  • Thanks for the reply.

    The code for Public Overloads Overridable Function Fill is from a strongly typed dataset generated by the dataset designer in VS 2013. So all objects should have been created by the designer. I've also used the hover over trick to see what object is null, but all objects on the that line have been assigned an instance. For example:

    dataTable = Users (my users table) has no rows at this point, but that would make since because it was not filled yet.

    Me.Adapter = System.Data.SqlClient.SqlDataAdapter

    Adapter is a property of the class as follows:

           <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
             Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")>  _
            Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter
                Get
                    If (Me._adapter Is Nothing) Then
                        Me.InitAdapter
                    End If
                    Return Me._adapter
                End Get
            End Property
     
    The above shows that if the adapter is nothing the InitAdapter is called

           <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
             Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")>  _
            Private Sub InitAdapter()
                Me._adapter = New Global.System.Data.SqlClient.SqlDataAdapter()
                Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping()
                tableMapping.SourceTable = "Table"
                tableMapping.DataSetTable = "Users"
                tableMapping.ColumnMappings.Add("UserId", "UserId")
                tableMapping.ColumnMappings.Add("Password", "Password")
                tableMapping.ColumnMappings.Add("Role", "Role")
                tableMapping.ColumnMappings.Add("RoleId", "RoleId")
                tableMapping.ColumnMappings.Add("C_FirstName", "C_FirstName")
                tableMapping.ColumnMappings.Add("C_LastName", "C_LastName")
                tableMapping.ColumnMappings.Add("isCounselor", "isCounselor")
                tableMapping.ColumnMappings.Add("ClinicianId", "ClinicianId")
                tableMapping.ColumnMappings.Add("siteId", "siteId")
                tableMapping.ColumnMappings.Add("isActive", "isActive")
                tableMapping.ColumnMappings.Add("isFacilitator", "isFacilitator")
                tableMapping.ColumnMappings.Add("isDoctor", "isDoctor")
                tableMapping.ColumnMappings.Add("isNurse", "isNurse")
                tableMapping.ColumnMappings.Add("PriorityLicenseType", "PriorityLicenseType")
                tableMapping.ColumnMappings.Add("OldCounselorId", "OldCounselorId")
                tableMapping.ColumnMappings.Add("OldDocID", "OldDocID")
                tableMapping.ColumnMappings.Add("OldFACId", "OldFACId")
                tableMapping.ColumnMappings.Add("isNursePractitioner", "isNursePractitioner")
                tableMapping.ColumnMappings.Add("isParoleOfficer", "isParoleOfficer")
                tableMapping.ColumnMappings.Add("ShelterId", "ShelterId")
                tableMapping.ColumnMappings.Add("TaxonomyCode", "TaxonomyCode")
                tableMapping.ColumnMappings.Add("isPrimaryBillingDoctor", "isPrimaryBillingDoctor")
                Me._adapter.TableMappings.Add(tableMapping)
                Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand()
                Me._adapter.DeleteCommand.Connection = Me.Connection
                Me._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[Users] WHERE (([UserId] = @Original_UserId) AND ((@IsNull_Pass"& _ 
                    "word = 1 AND [Password] IS NULL) OR ([Password] = @Original_Password)) AND ((@Is"& _ 
                    "Null_Role = 1 AND [Role] IS NULL) OR ([Role] = @Original_Role)) AND ((@IsNull_Ro"& _ 
                    "leId = 1 AND [RoleId] IS NULL) OR ([RoleId] = @Original_RoleId)) AND ((@IsNull_C"& _ 
                    "_FirstName = 1 AND [C_FirstName] IS NULL) OR ([C_FirstName] = @Original_C_FirstN"& _ 
                    "ame)) AND ((@IsNull_C_LastName = 1 AND [C_LastName] IS NULL) OR ([C_LastName] = "& _ 
                    "@Original_C_LastName)) AND ((@IsNull_isCounselor = 1 AND [isCounselor] IS NULL) "& _ 
                    "OR ([isCounselor] = @Original_isCounselor)) AND ([ClinicianId] = @Original_Clini"& _ 
                    "cianId) AND ([siteId] = @Original_siteId) AND ((@IsNull_isActive = 1 AND [isActi"& _ 
                    "ve] IS NULL) OR ([isActive] = @Original_isActive)) AND ((@IsNull_isFacilitator ="& _ 
                    " 1 AND [isFacilitator] IS NULL) OR ([isFacilitator] = @Original_isFacilitator)) "& _ 
                    "AND ((@IsNull_isDoctor = 1 AND [isDoctor] IS NULL) OR ([isDoctor] = @Original_is"& _ 
                    "Doctor)) AND ((@IsNull_isNurse = 1 AND [isNurse] IS NULL) OR ([isNurse] = @Origi"& _ 
                    "nal_isNurse)) AND ((@IsNull_PriorityLicenseType = 1 AND [PriorityLicenseType] IS"& _ 
                    " NULL) OR ([PriorityLicenseType] = @Original_PriorityLicenseType)) AND ((@IsNull"& _ 
                    "_OldCounselorId = 1 AND [OldCounselorId] IS NULL) OR ([OldCounselorId] = @Origin"& _ 
                    "al_OldCounselorId)) AND ((@IsNull_OldDocID = 1 AND [OldDocID] IS NULL) OR ([OldD"& _ 
                    "ocID] = @Original_OldDocID)) AND ((@IsNull_OldFACId = 1 AND [OldFACId] IS NULL) "& _ 
                    "OR ([OldFACId] = @Original_OldFACId)) AND ((@IsNull_isNursePractitioner = 1 AND "& _ 
                    "[isNursePractitioner] IS NULL) OR ([isNursePractitioner] = @Original_isNursePrac"& _ 
                    "titioner)) AND ((@IsNull_isParoleOfficer = 1 AND [isParoleOfficer] IS NULL) OR ("& _ 
                    "[isParoleOfficer] = @Original_isParoleOfficer)) AND ((@IsNull_ShelterId = 1 AND "& _ 
                    "[ShelterId] IS NULL) OR ([ShelterId] = @Original_ShelterId)) AND ((@IsNull_Taxon"& _ 
                    "omyCode = 1 AND [TaxonomyCode] IS NULL) OR ([TaxonomyCode] = @Original_TaxonomyC"& _ 
                    "ode)) AND ((@IsNull_isPrimaryBillingDoctor = 1 AND [isPrimaryBillingDoctor] IS N"& _ 
                    "ULL) OR ([isPrimaryBillingDoctor] = @Original_isPrimaryBillingDoctor)))"
                Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_UserId", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "UserId", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Password", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Password", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Password", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Password", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Role", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Role", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Role", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Role", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_RoleId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RoleId", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_RoleId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RoleId", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_C_FirstName", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "C_FirstName", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
                Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_C_FirstName", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "C_FirstName", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
                  Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand()
                Me._adapter.InsertCommand.Connection = Me.Connection
                Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[Users] ([UserId], [Password], [Role], [RoleId], [C_FirstName],"& _ 
                    " [C_LastName], [isCounselor], [siteId], [isActive], [isFacilitator], [isDoctor],"& _ 
                    " [isNurse], [PriorityLicenseType], [OldCounselorId], [OldDocID], [OldFACId], [is"& _ 
                    "NursePractitioner], [isParoleOfficer], [ShelterId], [TaxonomyCode], [isPrimaryBi"& _ 
                    "llingDoctor]) VALUES (@UserId, @Password, @Role, @RoleId, @C_FirstName, @C_LastN"& _ 
                    "ame, @isCounselor, @siteId, @isActive, @isFacilitator, @isDoctor, @isNurse, @Pri"& _ 
                    "orityLicenseType, @OldCounselorId, @OldDocID, @OldFACId, @isNursePractitioner, @"& _ 
                    "isParoleOfficer, @ShelterId, @TaxonomyCode, @isPrimaryBillingDoctor);"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT Us"& _ 
                    "erId, Password, Role, RoleId, C_FirstName, C_LastName, isCounselor, ClinicianId,"& _ 
                    " siteId, isActive, isFacilitator, isDoctor, isNurse, PriorityLicenseType, OldCou"& _ 
                    "nselorId, OldDocID, OldFACId, isNursePractitioner, isParoleOfficer, ShelterId, T"& _ 
                    "axonomyCode, isPrimaryBillingDoctor FROM Users WHERE (ClinicianId = SCOPE_IDENTI"& _ 
                    "TY()) AND (siteId = @siteId)"
                Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@UserId", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "UserId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Password", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Password", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Role", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Role", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RoleId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RoleId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@C_FirstName", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "C_FirstName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@C_LastName", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "C_LastName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isCounselor", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isCounselor", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@siteId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "siteId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isActive", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isActive", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isFacilitator", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isFacilitator", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isDoctor", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isDoctor", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isNurse", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isNurse", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isPrimaryBillingDoctor", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isPrimaryBillingDoctor", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand()
                Me._adapter.UpdateCommand.Connection = Me.Connection
                Me._adapter.UpdateCommand.CommandText = "UPDATE [dbo].[Users] SET [UserId] = @UserId, [Password] = @Password, [Role] = @Ro"& _ 
                    "le, [RoleId] = @RoleId, [C_FirstName] = @C_FirstName, [C_LastName] = @C_LastName"& _ 
                    ", [isCounselor] = @isCounselor, [siteId] = @siteId, [isActive] = @isActive, [isF"& _ 
                    "acilitator] = @isFacilitator, [isDoctor] = @isDoctor, [isNurse] = @isNurse, [Pri"& _ 
                    "orityLicenseType] = @PriorityLicenseType, [OldCounselorId] = @OldCounselorId, [O"& _ 
                    "ldDocID] = @OldDocID, [OldFACId] = @OldFACId, [isNursePractitioner] = @isNursePr"& _ 
                    "actitioner, [isParoleOfficer] = @isParoleOfficer, [ShelterId] = @ShelterId, [Tax"& _ 
                    "onomyCode] = @TaxonomyCode, [isPrimaryBillingDoctor] = @isPrimaryBillingDoctor W"& _ 
                    "HERE (([UserId] = @Original_UserId) AND ((@IsNull_Password = 1 AND [Password] IS"& _ 
                    " NULL) OR ([Password] = @Original_Password)) AND ((@IsNull_Role = 1 AND [Role] I"& _ 
                    "S NULL) OR ([Role] = @Original_Role)) AND ((@IsNull_RoleId = 1 AND [RoleId] IS N"& _ 
                    "ULL) OR ([RoleId] = @Original_RoleId)) AND ((@IsNull_C_FirstName = 1 AND [C_Firs"& _ 
                    "tName] IS NULL) OR ([C_FirstName] = @Original_C_FirstName)) AND ((@IsNull_C_Last"& _ 
                    "Name = 1 AND [C_LastName] IS NULL) OR ([C_LastName] = @Original_C_LastName)) AND"& _ 
                    " ((@IsNull_isCounselor = 1 AND [isCounselor] IS NULL) OR ([isCounselor] = @Origi"& _ 
                    "nal_isCounselor)) AND ([ClinicianId] = @Original_ClinicianId) AND ([siteId] = @O"& _ 
                    "riginal_siteId) AND ((@IsNull_isActive = 1 AND [isActive] IS NULL) OR ([isActive"& _ 
                    "] = @Original_isActive)) AND ((@IsNull_isFacilitator = 1 AND [isFacilitator] IS "& _ 
                    "NULL) OR ([isFacilitator] = @Original_isFacilitator)) AND ((@IsNull_isDoctor = 1"& _ 
                    " AND [isDoctor] IS NULL) OR ([isDoctor] = @Original_isDoctor)) AND ((@IsNull_isN"& _ 
                    "urse = 1 AND [isNurse] IS NULL) OR ([isNurse] = @Original_isNurse)) AND ((@IsNul"& _ 
                    "l_PriorityLicenseType = 1 AND [PriorityLicenseType] IS NULL) OR ([PriorityLicens"& _ 
                    "eType] = @Original_PriorityLicenseType)) AND ((@IsNull_OldCounselorId = 1 AND [O"& _ 
                    "ldCounselorId] IS NULL) OR ([OldCounselorId] = @Original_OldCounselorId)) AND (("& _ 
                    "@IsNull_OldDocID = 1 AND [OldDocID] IS NULL) OR ([OldDocID] = @Original_OldDocID"& _ 
                    ")) AND ((@IsNull_OldFACId = 1 AND [OldFACId] IS NULL) OR ([OldFACId] = @Original"& _ 
                    "_OldFACId)) AND ((@IsNull_isNursePractitioner = 1 AND [isNursePractitioner] IS N"& _ 
                    "ULL) OR ([isNursePractitioner] = @Original_isNursePractitioner)) AND ((@IsNull_i"& _ 
                    "sParoleOfficer = 1 AND [isParoleOfficer] IS NULL) OR ([isParoleOfficer] = @Origi"& _ 
                    "nal_isParoleOfficer)) AND ((@IsNull_ShelterId = 1 AND [ShelterId] IS NULL) OR (["& _ 
                    "ShelterId] = @Original_ShelterId)) AND ((@IsNull_TaxonomyCode = 1 AND [TaxonomyC"& _ 
                    "ode] IS NULL) OR ([TaxonomyCode] = @Original_TaxonomyCode)) AND ((@IsNull_isPrim"& _ 
                    "aryBillingDoctor = 1 AND [isPrimaryBillingDoctor] IS NULL) OR ([isPrimaryBilling"& _ 
                    "Doctor] = @Original_isPrimaryBillingDoctor)));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT UserId, Password, Role, R"& _ 
                    "oleId, C_FirstName, C_LastName, isCounselor, ClinicianId, siteId, isActive, isFa"& _ 
                    "cilitator, isDoctor, isNurse, PriorityLicenseType, OldCounselorId, OldDocID, Old"& _ 
                    "FACId, isNursePractitioner, isParoleOfficer, ShelterId, TaxonomyCode, isPrimaryB"& _ 
                    "illingDoctor FROM Users WHERE (ClinicianId = @ClinicianId) AND (siteId = @siteId"& _ 
                    ")"
                Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@UserId", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "UserId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Password", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Password", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Role", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Role", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RoleId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RoleId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@C_FirstName", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "C_FirstName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@C_LastName", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "C_LastName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isCounselor", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isCounselor", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@siteId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "siteId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isActive", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isActive", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isFacilitator", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isFacilitator", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isDoctor", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isDoctor", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isNurse", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "isNurse", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@PriorityLicenseType", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "PriorityLicenseType", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
                Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@OldCounselorId", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OldCounselorId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            End Sub

    BtW, I did remove some of the Parameter.Add lines from above to save space here.

    Me = WA_MMTP_TrackerDataSet1TableAdapters.UsersTableAdapter

    For the first set of code which calls the methods of the strongly typed datasetfor UsersTableAdapter1, it is declared as:

    Friend WithEvents UsersTableAdapter1 As AttendTrackerFull.WA_MMTP_TrackerDataSet1TableAdapters.UsersTableAdapter

    And later in the form designer code we have:

    Me.UsersTableAdapter1 = New AttendTrackerFull.WA_MMTP_TrackerDataSet1TableAdapters.UsersTableAdapter()

    So I'm sure that this section of the code should not be the issue. 

    I hope the added info can help.

    Thanks again

    Michael      

    Thursday, April 9, 2015 11:27 AM
  • yes that is what Fred and I thought it was. 

    You use a DataAdapter with your strongly typed dataset.

    Fred provided code for that, in a little bit C# or VB framework 1.0 style. 

    This is it for newer frameworks then 3.0

    Dim dt As as New DataSet1.OrderDataTable Using da as New DataSet1TableAdapters.OrderTableAdapter da.Fill(dt)

    end using

    But that is a peanut.



    Success
    Cor


    Thursday, April 9, 2015 11:42 AM
  • Thanks for the reply,

    FYI, The form that contains the table adapters has a C1 scheduler control on the form which uses the typed dataset. Which is why that WA_MMTP_TrackerDataSet1 is being referenced in the code (the scheduler control uses this reference to do its db updates.) Also note, I have the same code in a VS 2008 project that does not give me the issues I've mentioned. I did recreate the typed dataset (cause VS didn't like me adding the old one as an existing object.) when I brought the project over to VS2013. Stopped working after the upgrade to VS2013. May not be the issue, but I thought I'd bring it up.

    UsersTableAdapter1 is a adapter that was added from the toolbox to the form so it can be referenced in the form, so the form designer takes care of creating the object as I showed above. What's confusing is that I have other code in the same function that works just fine, like this:

    Dim dd As System.Data.SqlClient.SqlCommand
    dd.CommandText = "SELECT [LabelId] ,[Text],[Description],[Color] FROM [dbo].[SchedLabels]"
    Me.SchedLabelsTableAdapter1.Adapter.SelectCommand = dd  
    me.SchedLabelsTableAdapter1.Connection = OpenConnection
    Me.SchedLabelsTableAdapter1.Fill(WA_MMTP_TrackerDataSet1.SchedLabels)
    dd.CommandText = "SELECT [StatusId],[Text],[Description],[Color],[Sortorder] FROM [dbo].[SchedStatuses]"
    Me.SchedStatusesTableAdapter1.Adapter.SelectCommand = dd  
    me.SchedStatusesTableAdapter1.Connection = OpenConnection
    Me.SchedStatusesTableAdapter1.Fill(WA_MMTP_TrackerDataSet1.SchedStatuses)
    
    So it seems I'm doing everything right. I know I'm not creating the object in my own code, but I have made sure the form designer code is creating the object. So I'm not sure where the issue is.


      

    Thursday, April 9, 2015 12:38 PM
  • Hello Mikelll,

    >>I've also used the hover over trick to see what object is null, but all objects on the that line have been assigned an instance.

    Do you mean all objects in this line “Dim returnValue As Integer = Me.Adapter.Fill(dataTable)” are initialized? If so, this is confused, I am wondering if this exception is thrown inside from the Fill() method(). Since it is .NET resource code, there is a blog which shows us we can debug the .NET source cdoe: http://blogs.msdn.com/b/dotnet/archive/2014/02/24/a-new-look-for-net-reference-source.aspx, please check it to see with it if you could find the real caused reason.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 10, 2015 5:25 AM
  • This line “Dim returnValue As Integer = Me.Adapter.Fill(dataTable)”  is inside the Designer code of the dataset. and Yes It does appear that all the objects are initialized. That's one reason I'm here asking the question, because its not making much since to me. I've unchecked the "Enable Just My code" option in the Debugging section of the options windows in VS2013 so I could step though the designer code. It always errors out on the above line in the following finction inside the dataset:

    <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0"), _ Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _ Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)> _ Public Overloads Overridable Function Fill(ByVal dataTable As WA_MMTP_TrackerDataSet1.UsersDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If

    ''''Fails on the next line'''''

    Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function

    Very Puzzling. I guess I'll have to try and recreate the dataset from scratch again and see if the issue continues :(
    Friday, April 10, 2015 10:43 AM
  • on

    Very Puzzling. I guess I'll have to try and recreate the dataset from scratch again and see if the issue continues :(

    Another option. 

    Right Click on the dataset and choose. Configure. Then you don't have to do everything. 


    Success
    Cor

    Friday, April 10, 2015 4:08 PM