|
|
|
start date: Mon, 6 Aug 2007 21:54:54 -0400,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
Jen
|
|
2
Miha Markic miha at rthand com
|
|
3
Jen
|
|
4
Miha Markic miha at rthand com
|
Detecting database column data type of smalldatetime vs. datetime?
Is there a way for C# ADO.NET code to determine whether a SQL Server column
data type is smalldatetime vs. datetime? It looks like DataColumn.DataType
makes no distinction, both return DateTime.
Date:Mon, 6 Aug 2007 21:54:54 -0400
Author:
|
Re: Detecting database column data type of smalldatetime vs. datetime?
You should use SqlConnection.GetSchema method to retrieve these kind of
information.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"Jen" wrote in message
news:Op1I2XJ2HHA.6072@TK2MSFTNGP03.phx.gbl...
> Is there a way for C# ADO.NET code to determine whether a SQL Server
> column data type is smalldatetime vs. datetime? It looks like
> DataColumn.DataType makes no distinction, both return DateTime.
>
Date:Tue, 7 Aug 2007 09:49:54 +0200
Author:
|
Re: Detecting database column data type of smalldatetime vs. datetime?
I'm using OleDb. Would I use OleDbConnection.GetOldDbSchemaTable? I'm
trying that but both smalldatetime and datetime data types seem to return
135.
Can I not distinguish between the two data types when using OleDb?
"Miha Markic" <miha at rthand com> wrote in message
news:A8CBEE33-5A89-4DA0-BBA5-02C5E27DCC0B@microsoft.com...
> You should use SqlConnection.GetSchema method to retrieve these kind of
> information.
>
> --
> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Jen" wrote in message
> news:Op1I2XJ2HHA.6072@TK2MSFTNGP03.phx.gbl...
>> Is there a way for C# ADO.NET code to determine whether a SQL Server
>> column data type is smalldatetime vs. datetime? It looks like
>> DataColumn.DataType makes no distinction, both return DateTime.
>>
>
Date:Tue, 7 Aug 2007 13:22:48 -0400
Author:
|
Re: Detecting database column data type of smalldatetime vs. datetime?
If GetOldDbSchemaTable doesn't suite you then you should use DDL statements
(i.e. sp_columns stored procedure should do)
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"Jen" wrote in message
news:OIQ$WeR2HHA.3640@TK2MSFTNGP06.phx.gbl...
> I'm using OleDb. Would I use OleDbConnection.GetOldDbSchemaTable? I'm
> trying that but both smalldatetime and datetime data types seem to return
> 135.
>
> Can I not distinguish between the two data types when using OleDb?
>
>
> "Miha Markic" <miha at rthand com> wrote in message
> news:A8CBEE33-5A89-4DA0-BBA5-02C5E27DCC0B@microsoft.com...
>> You should use SqlConnection.GetSchema method to retrieve these kind of
>> information.
>>
>> --
>> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
>> RightHand .NET consulting & development www.rthand.com
>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>>
>> "Jen" wrote in message
>> news:Op1I2XJ2HHA.6072@TK2MSFTNGP03.phx.gbl...
>>> Is there a way for C# ADO.NET code to determine whether a SQL Server
>>> column data type is smalldatetime vs. datetime? It looks like
>>> DataColumn.DataType makes no distinction, both return DateTime.
>>>
>>
>
>
Date:Wed, 8 Aug 2007 09:44:53 +0200
Author:
|
|
|