Click to See Complete Forum and Search --> : How can i add a boolean column to a datatable


gibea00
March 28th, 2003, 07:27 AM
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

Iouri
March 29th, 2003, 11:47 AM
_adoDTRole.Columns.Add("Accorder", Type.GetType("System.boolean"))

This line is correct.
I thinkthe problem is that in your db null is not allowed

gknierim
April 4th, 2003, 09:13 AM
I had the same problem recently and just used this:


_adoDTRole.Columns.Add("Accorder", GetType(System.Boolean))

without the Type. and the quotes. I got the same error using Type.GetType....


HTH,
Greg