Re: Determining a SQL Server datatype length

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: NuTcAsE (rao.ritesh_at_gmail.com)
Date: 02/04/05


Date: 4 Feb 2005 08:47:22 -0800

Hey Joe,

Well the approach I suggested is very SQL Server centric. In any case
which ever database you do use, you will first need to get the schema
of the stored proc and check out its parameter lengths. Im not sure how
that is achieved on other databases, but you can abstract the
functionality of getting the parameter lengths into a seperate project.

It would work something like this:

1. Main application calls GetParameterLength ("paramName", "sprocName",
DbConnection connection) :int of lets say a project called DbSchema.dll
2. DbSchema project first checks the provider type of the connection
(currently in 1.1 you can do this by checking its type).
3. If the connection is of SqlConnection, then you execute the above
example and get the parameter lenth. If its say OracleConnection, you
use an oracle specific query (im sure you can get schema information
for oracle too). Basically a switch statement to execute the correct
query.

Apart from that AFIK there is not .net generic way to get the schema
information of a stored proc. Sorry

NuTcAsE


Quantcast