>Subject: Re: [ADVANCED-DOTNET] Elegant way of handling "nulls" >when assigning to the DateTime structure > >I would suggest to use specific .NET Data Provider types (as >System.Data.SqlTypes
While everyone is hot on the type subject, I would like to ask... Does anyone know for certain if type casting values returned from a SQL Data connection as the way of extracting the property value will greatly reduce performance? I have been told that this would pull the value in as a SQL data type, cast it out as an available data type to the code at runtime, then casting it back to an available type so that the requested cast can be completed and send the value into a property where it will have to be type cast once more back to the executing code as requested type value. That seems like a whole lot of value casting where it would be just as easy to use the native SQLDatatypes. PS: it also seems to be less runtime executable code. So I always try NOT to write this, Dim stringVarient As String If Not SomeSQLDataREader(0).getvalue = DBNull.value Then stringVarient = SomeSQLDataREader(0).getvalue When I can write... If Not SomeSQLDataReader.IsDBNull(0) Then dim stringVarient As String = SomeSQLDataREader.getSQLString(0) I have been told that this syntax is good and I have been told that it is exception prone. Which is true? =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
