CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Posts
    47

    How can i add a boolean column to a datatable

    Hi!

    I'm creating a dataTable using a sql query. I would like to add a boolean column to that dataTAble, but that doesn't works.

    here's what i'm doing

    _strSQL = "SELECT role, descr " & _
    "FROM code_role "

    _odpcmdSelect = New Oracle.DataAccess.Client.OracleCommand
    _odpcmdSelect.Connection = global.oracleConnection
    _odpcmdSelect.CommandText = _strSQL

    _odpdaUtilRole = New Oracle.DataAccess.Client.OracleDataAdapter
    _odpdaUtilRole.SelectCommand = _odpcmdSelect

    _adoDTRole = New DataTable
    _odpdaUtilRole.Fill(_adoDTRole)

    _adoDTRole.Columns.Add("Accorder", Type.GetType("System.boolean"))

    _adoDTRole.AcceptChanges()


    I always have an error message saying that my dataType argument cannot be null


    Why ?


    Thanks for your help

    Alex
    Alexandre

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878
    _adoDTRole.Columns.Add("Accorder", Type.GetType("System.boolean"))

    This line is correct.
    I thinkthe problem is that in your db null is not allowed
    Iouri Boutchkine
    iouri@hotsheet.NOSPAM.com

  3. #3
    Join Date
    Jan 2000
    Posts
    264
    I had the same problem recently and just used this:

    Code:
    _adoDTRole.Columns.Add("Accorder", GetType(System.Boolean))
    without the Type. and the quotes. I got the same error using Type.GetType....


    HTH,
    Greg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured