dataset name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Day

    dataset name

    Using vs2003, vb net.

    Why does DS>DataSetName return the base name DS_Caller_Base instead of the
    instantiated Name of DataSet1? See '**** for the line in question.

    Friend sub1

    ' instantiate new dataset

    dim DataSet1 as new DS_Caller_Base

    ' pass new dataset to sub2

    sub2(DataSet1)

    end sub

    Friend sub2(ByRef DS As DS_Caller_Base)

    ' Note that the DataSetName below give its base name (not sure why),
    instead of the name of the passed instantiated dataset.

    dim x as string = DS.DataSetName '************** ***

    ' why does x = DS_Caller_Base and not x = DataSet1

    end sub

    Thanks!

    Bob


  • Gary Chang

    #2
    RE: dataset name

    Hi Bob,

    Thanks for using Microsoft MSDN Managed Newsgroup.
    My name is Gary, and I will be assisting you on this issue.

    First of all, I would like to confirm my understanding of your issue.

    From your description, I understand that when you defended as:
    Dim DataSet1 as new DS_Caller_Base 'assume as DataSet
    the DataSet1.DataSe tName = "DS_Caller_Base ", you wonder why is not the
    "DataSet1"

    Have I fully understood you? If there is anything I misunderstood, please
    feel free to let me know.


    Based on my knowledge, the "DataSet1" is the identity name(ID) of your
    instantiated DataSet object(in other words it is your DataSet variable's
    name, it is only recognized within your program code and just visible to
    the compiler), it is not the DataSet object(represen t by DataSet1)'s name.

    The DataSet1object has its own default name(this is a property of the
    DataSet class)(DS_Calle r_Base"("NewDat aSet"), you can change its default
    name by
    e.g. DataSet1.DataSe tName = "My DataSet"


    Hope I can make my words understood easily!

    Thank!

    Best regards,

    Gary Chang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------

    Comment

    • Bob Day

      #3
      Re: dataset name 2

      Yes you understand my question. Your answer is correct, but doesn't make
      much sense. Asside from ".DataSetNa me" being a confusing way to mean
      ".DataSetBaseNa me", how do I get the instantiated dataset name?

      The way ".DataSetNa me" works is like saying:
      Dim x as integer
      dim y as string = x.VarialbleName
      y would return "Integer".

      I am instantiating a Component Designer file that has many DataSets in it,
      so it is not feasible for me to go through and try to name each instantiated
      dataset one by one with some line like:
      DataSet1.DataSe tName = "DataSet1"

      So, how can I return the instantiated DataSet1 name? I don't see anyway.

      Thanks!

      Bob



      "Gary Chang" <v-garych@online.m icrosoft.com> wrote in message
      news:Loe647K3DH A.1988@cpmsftng xa07.phx.gbl...[color=blue]
      > Hi Bob,
      >
      > Thanks for using Microsoft MSDN Managed Newsgroup.
      > My name is Gary, and I will be assisting you on this issue.
      >
      > First of all, I would like to confirm my understanding of your issue.
      >
      > From your description, I understand that when you defended as:
      > Dim DataSet1 as new DS_Caller_Base 'assume as DataSet
      > the DataSet1.DataSe tName = "DS_Caller_Base ", you wonder why is not the
      > "DataSet1"
      >
      > Have I fully understood you? If there is anything I misunderstood, please
      > feel free to let me know.
      >
      >
      > Based on my knowledge, the "DataSet1" is the identity name(ID) of your
      > instantiated DataSet object(in other words it is your DataSet variable's
      > name, it is only recognized within your program code and just visible to
      > the compiler), it is not the DataSet object(represen t by DataSet1)'s name.
      >
      > The DataSet1object has its own default name(this is a property of the
      > DataSet class)(DS_Calle r_Base"("NewDat aSet"), you can change its default
      > name by
      > e.g. DataSet1.DataSe tName = "My DataSet"
      >
      >
      > Hope I can make my words understood easily!
      >
      > Thank!
      >
      > Best regards,
      >
      > Gary Chang
      > Microsoft Online Partner Support
      >
      > Get Secure! - www.microsoft.com/security
      > This posting is provided "AS IS" with no warranties, and confers no[/color]
      rights.[color=blue]
      > --------------------
      >[/color]


      Comment

      • Gary Chang

        #4
        Re: dataset name 2

        Hi Bob,

        Thanks for your quickly reply!

        As my last post description, the instantiated DataSet object's
        name(DataSet1) is just a symbol to represent the DataSet object in your
        code(design time).

        However the ".DataSetNa me" is a *property* of the DataSet class, the
        default value of this property is its class name, which is defined in MSDN.
        That is to say, it returns the class name of a variable by default, not
        variable name. we can assign it a meaningful name and use it at run-time.
        [color=blue]
        >I am instantiating a Component Designer file that has many DataSets in it,
        >so it is not feasible for me to go through and try to name each[/color]
        instantiated[color=blue]
        >dataset one by one with some line like:
        > DataSet1.DataSe tName = "DataSet1"
        >
        >So, how can I return the instantiated DataSet1 name? I don't see anyway.[/color]

        So there is no easy ways to return the instantiated object's name(DataSet1)
        Automatically. In order to get a variable's name, we need to set its
        DataSetName property manually in coding. Since the class is developed by
        you, you could also add a customized property to store this name by
        yourself.

        Does that answer your question? If there is any unclear, please feel free
        to post here.


        Thanks!

        Best regards,

        Gary Chang
        Microsoft Online Partner Support

        Get Secure! - www.microsoft.com/security
        This posting is provided "AS IS" with no warranties, and confers no rights.
        --------------------

        Comment

        Working...