Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDT in DataColumn
Message
De
06/09/2007 07:44:15
 
 
À
05/09/2007 11:06:21
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01251752
Message ID:
01252674
Vues:
18
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform