locked
Weird field on dataset RRS feed

  • Question

  • User-693967744 posted

    I have a pretty weird issue here

    In my web application, i use a global dataset for storing the data used, and there are times, the data that the datast is handling is quite a lot. I noticed something quite weird. Lets says i select some data from my database

    Select field1, field2, field3, field4, field5 from tableA

    So far so good, then, i fill the dataset on my function, which recibes the dataset i'm working with, the query and a table name, inside the function, i clear the table in case i found it.

    There are times, where my table "tableA" in my dataset has one more extra field, lets calls it fieldx, and because i didn't request it, it comes with null values.

    Any idea, why when filling my dataset, with my requested fields, an extra field appears?

    Monday, August 8, 2011 12:21 PM

Answers

  • User3866881 posted

    Hello cjLopez:)

     Private Sub Fill_DataSet(ByVal DS As Data.DataSetByVal query As StringByVal tableName As String)
            myAdapter = createAdapter(query)
            If DS.Tables.Contains(tableName) Then
                'DS.Tables(tableName).Clear()             DS.Tables.Remove(tableName)  'Please remove it first instead of clearing         End If
            Try
                myAdapter.Fill(DS, tableName)
            Catch ex As Exception
                sendErrorMessage(ex)
            End Try
        End Sub
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 10, 2011 10:23 PM

All replies

  • User-451260051 posted

    Can you post the code you are using?

    Monday, August 8, 2011 12:38 PM
  • User-693967744 posted

    Sadly, i cant, given the size of the project, but this is just kinda of a example of what it is

     Variables.myVariables '<---- this is where the my global dataset is declared
    
    private function retrieveData(ByVal param1 as String) dbProcess.Start() dbProcess.Fill_DataSet(dataset, query.retrieveFields(param1), "fields") dbProcess.End() end function ' This is stored on another class, where i keep all my queries
    private Funtcion retrieveFields(ByVal param1 as String) as String return "Select field1, field2, field3, field4 from tableA where conditional = " + param1 end Function ' This is stored on another class which handles all database connections and comunication
    private Sub Fill_DataSet(byVal DS as Data.DataSet, ByVal query as String, ByVal tableName as String) myAdapter = createAdapter(query) if DS.Tables.Contains(tableName) then DS.Tables(tableName).Clear() end if try myAdapter.Fill(DS, tableName) catch ex as Exception sendErrorMessage(ex) end try end Sub

    this is mostly how things are done when retrieving info from the database, and as i said, i noticed that sometimes, an extra, which is not indicated on the query, is found in the DataSet, on the recently created table

    Monday, August 8, 2011 12:55 PM
  • User3866881 posted

    Hello cjLopez:)

     Private Sub Fill_DataSet(ByVal DS As Data.DataSetByVal query As StringByVal tableName As String)
            myAdapter = createAdapter(query)
            If DS.Tables.Contains(tableName) Then
                'DS.Tables(tableName).Clear()             DS.Tables.Remove(tableName)  'Please remove it first instead of clearing         End If
            Try
                myAdapter.Fill(DS, tableName)
            Catch ex As Exception
                sendErrorMessage(ex)
            End Try
        End Sub
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 10, 2011 10:23 PM