PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
DataType Quandry
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
DataType Quandry
![]() |
DataType Quandry |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I found a way to handle it. Thanks
Javed >-----Original Message----- >Using SQLDataReader, I am trying to read complete rows of >data as opposed to reading individual columns like a >chicken (peck, peck, peck) > >using the GetSchemaTable method of the Reader, I add >columns to my table which will receive the data as >follows: > >SchemaTable = myReader.GetSchemaTable() >For Each aRow In SchemaTable.Rows > dt.Columns.Add(aRow("ColumnName").ToString(), aRow >("datatype")) >Next > >I then use the following loop to read the data into my >table, dt: > >While myReader.Read > MyRow = dt.NewRow > For Each aRow In SchemaTable.Rows > MyRow(aRow("ColumnName").ToString) = myReader.Item >(aRow("ColumnName").ToString) > Next > dt.Rows.Add(MyRow) >End While > >Everything seems to work fine until I try to create a >DataRelation with a Manually created Child table. Child >table has a column added as follows: > >ChildTbl.Columns.Add("insf_id", GetType(System.Int32)) > >The parent table read above using the DataReader also has >a column, "insf_id" of Type System.int32. But when I >create the DataRelation, I get the error: > >"Parent columns and Child columns don't have type- >matching columns." > >I cannot figure out what I doing wrong. To get the >datatype from the schematable, I have also used: > >dt.Columns.Add(aRow("ColumnName").ToString(), >System.Type.GetType(aRow("datatype").fullname)) > >but to no avail. I would appreciate any help. > >Javed > >. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

