Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDT in DataColumn
Message
From
06/09/2007 07:44:15
 
 
To
05/09/2007 11:06:21
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01251752
Message ID:
01252674
Views:
19
Hi,

I tried it. The short answer is 'yes, it works' but, of course, to subsequently access properties of the UDT directly from the data cell it has to be cast to the UDT Type e.g.:
string s = ((TestUDT) DataRow["ColumnName"]).SomeStringProperty;
I guess using a strongly named dataset will let me use 'DataRow.ColumnName.SomeStringProperty' etc. but that means I'd have to cast the output from the datareader when assigning it to the cell which in turn means I can't code a generic way of building the table.

On top of that I've realized I've SQL columns in some tables that will need to contain objects of different types so UDTs are ruled out there anyway and I'll just have to use varbinary.

Oh well, regards,
Viv

>I'm sorry I don't have an answer for you, but I wondered if you got this all figured out yet.
>
>I don't use DataReaders, so without actually playing with this a bit myself, I didn't want to take a stab at the answer (I hate being wrong <g>). I've been way too busy to do any playing though.
>
>~~Bonnie
>
>
>
>>Hi,
>>
>>I'm looking at using .NET UDTs in SQLSERVER. The twist is that we need to construct a .NET DataTable on the fly and then add them in using a DataReader. I can query the DB for the UDT type and set the relevant properties when I create the DataColumn but I'm not sure whether this will let me populate the row without casting using something like: DataRow["ColumnName"] = dr["Data"]
>>
>>Won't work on this till Monday so maybe someone will let me know if I'm going to be wasting by time before then......
>>
>>Regards,
>>Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform