Can't Find Column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • André Almeida Maldonado

    Can't Find Column

    When I use this code:

    Dim dtsDataSet As DataSet = New DataSet("Dados" )
    Dim dttUsuarios As DataTable = dtsDataSet.Tabl es.Add("Usuario s")
    Dim dtvUsuarios As DataView = New DataView(dtsDat aSet.Tables("Us uarios"),
    "", "UsuaNome", DataViewRowStat e.CurrentRows)

    The compiler say that the column "UsuaNome" cannot be find, but it exists in
    the database... Why it happens?????


    Thank's...


  • Nicole Calinoiu

    #2
    Re: Can't Find Column

    André,

    You haven't actually populated the dataset or datatable in this code, so
    it's no surprise that the column is not found. Have you left out some code
    in your example? If so, you might want to consider using debug
    functionality to get a list of the tables and columns in the dataset at the
    point where the exception is raised. You will probably find that a lack of
    table mappings has caused your dataset to be populated in an unexpected
    manner.

    HTH,
    Nicole


    "André Almeida Maldonado" <deweb@bol.com. br> wrote in message
    news:uvr5nSmkDH A.1708@TK2MSFTN GP12.phx.gbl...[color=blue]
    > When I use this code:
    >
    > Dim dtsDataSet As DataSet = New DataSet("Dados" )
    > Dim dttUsuarios As DataTable = dtsDataSet.Tabl es.Add("Usuario s")
    > Dim dtvUsuarios As DataView = New DataView(dtsDat aSet.Tables("Us uarios"),
    > "", "UsuaNome", DataViewRowStat e.CurrentRows)
    >
    > The compiler say that the column "UsuaNome" cannot be find, but it exists[/color]
    in[color=blue]
    > the database... Why it happens?????
    >
    >
    > Thank's...
    >
    >[/color]


    Comment

    • André Almeida Maldonado

      #3
      Re: Can't Find Column


      Sorry, but I never made it.... What is the error in the code? How can I
      populate the dataset / datatable???

      Thank's......


      "Nicole Calinoiu" <nicolec@somewh ere.net> escreveu na mensagem
      news:O%23PEWdmk DHA.1960@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > André,
      >
      > You haven't actually populated the dataset or datatable in this code, so
      > it's no surprise that the column is not found. Have you left out some[/color]
      code[color=blue]
      > in your example? If so, you might want to consider using debug
      > functionality to get a list of the tables and columns in the dataset at[/color]
      the[color=blue]
      > point where the exception is raised. You will probably find that a lack[/color]
      of[color=blue]
      > table mappings has caused your dataset to be populated in an unexpected
      > manner.
      >
      > HTH,
      > Nicole
      >
      >
      > "André Almeida Maldonado" <deweb@bol.com. br> wrote in message
      > news:uvr5nSmkDH A.1708@TK2MSFTN GP12.phx.gbl...[color=green]
      > > When I use this code:
      > >
      > > Dim dtsDataSet As DataSet = New DataSet("Dados" )
      > > Dim dttUsuarios As DataTable = dtsDataSet.Tabl es.Add("Usuario s")
      > > Dim dtvUsuarios As DataView = New[/color][/color]
      DataView(dtsDat aSet.Tables("Us uarios"),[color=blue][color=green]
      > > "", "UsuaNome", DataViewRowStat e.CurrentRows)
      > >
      > > The compiler say that the column "UsuaNome" cannot be find, but it[/color][/color]
      exists[color=blue]
      > in[color=green]
      > > the database... Why it happens?????
      > >
      > >
      > > Thank's...
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Nicole Calinoiu

        #4
        Re: Can't Find Column

        André,

        The usual manner for populating a DataSet or DataTable from a database is to
        use the Fill method of a DataAdapter object. If you're not familiar with
        this method, you can find documentation at the following URL:
        http://msdn.microsoft.com/library/en...sfilltopic.asp.

        HTH,
        Nicole


        "André Almeida Maldonado" <deweb@bol.com. br> wrote in message
        news:OwIxwgmkDH A.2060@tk2msftn gp13.phx.gbl...[color=blue]
        >
        > Sorry, but I never made it.... What is the error in the code? How can I
        > populate the dataset / datatable???
        >
        > Thank's......
        >
        >
        > "Nicole Calinoiu" <nicolec@somewh ere.net> escreveu na mensagem
        > news:O%23PEWdmk DHA.1960@TK2MSF TNGP12.phx.gbl. ..[color=green]
        > > André,
        > >
        > > You haven't actually populated the dataset or datatable in this code, so
        > > it's no surprise that the column is not found. Have you left out some[/color]
        > code[color=green]
        > > in your example? If so, you might want to consider using debug
        > > functionality to get a list of the tables and columns in the dataset at[/color]
        > the[color=green]
        > > point where the exception is raised. You will probably find that a lack[/color]
        > of[color=green]
        > > table mappings has caused your dataset to be populated in an unexpected
        > > manner.
        > >
        > > HTH,
        > > Nicole
        > >
        > >
        > > "André Almeida Maldonado" <deweb@bol.com. br> wrote in message
        > > news:uvr5nSmkDH A.1708@TK2MSFTN GP12.phx.gbl...[color=darkred]
        > > > When I use this code:
        > > >
        > > > Dim dtsDataSet As DataSet = New DataSet("Dados" )
        > > > Dim dttUsuarios As DataTable = dtsDataSet.Tabl es.Add("Usuario s")
        > > > Dim dtvUsuarios As DataView = New[/color][/color]
        > DataView(dtsDat aSet.Tables("Us uarios"),[color=green][color=darkred]
        > > > "", "UsuaNome", DataViewRowStat e.CurrentRows)
        > > >
        > > > The compiler say that the column "UsuaNome" cannot be find, but it[/color][/color]
        > exists[color=green]
        > > in[color=darkred]
        > > > the database... Why it happens?????
        > > >
        > > >
        > > > Thank's...
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...