|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Column data typeTo send the result table from the stored procedure back to a client, I have to create SqlDataRecord and send the rows one-by-one. The constructor fro SqlDataRecord needs an instance of the SqlMetaData. To create this instance I need the type definition for a particular column. For example: SqlMetaData data = new SqlMetaData ("ColumnName", SqlDbType.NVarChar, 50); In my stored procedure I have a data adapter, that fills the data table: dad.Fill( myTable); To get column type: object obj = myTable.Columns[0].DataType.FulName; This will return System.String. How can I get the database types for the column, with the length specification? (SqlDbType.NVarChar, length constrain = 50). Thanks, Lubomir Hi, Lubo,
Check this out: http://msdn2.microsoft.com/en-us/library/ms172137.aspx HTH, Petar Atanasov http://a-wake.net Lubomir wrote: Show quote > Hi, > > To send the result table from the stored procedure back to a client, I have > to create SqlDataRecord and send the rows one-by-one. > > The constructor fro SqlDataRecord needs an instance of the SqlMetaData. To > create this instance I need the type definition for a particular column. > > For example: > SqlMetaData data = new SqlMetaData ("ColumnName", SqlDbType.NVarChar, 50); > > In my stored procedure I have a data adapter, that fills the data table: > dad.Fill( myTable); > > To get column type: > object obj = myTable.Columns[0].DataType.FulName; > > This will return System.String. > > How can I get the database types for the column, with the length > specification? (SqlDbType.NVarChar, length constrain = 50). > > Thanks, > Lubomir Hi Petar,
Thanks Lubomir Show quote "Petar Atanasov" wrote: > Hi, Lubo, > Check this out: > > http://msdn2.microsoft.com/en-us/library/ms172137.aspx > > HTH, > Petar Atanasov > http://a-wake.net > > Lubomir wrote: > > Hi, > > > > To send the result table from the stored procedure back to a client, I have > > to create SqlDataRecord and send the rows one-by-one. > > > > The constructor fro SqlDataRecord needs an instance of the SqlMetaData. To > > create this instance I need the type definition for a particular column. > > > > For example: > > SqlMetaData data = new SqlMetaData ("ColumnName", SqlDbType.NVarChar, 50); > > > > In my stored procedure I have a data adapter, that fills the data table: > > dad.Fill( myTable); > > > > To get column type: > > object obj = myTable.Columns[0].DataType.FulName; > > > > This will return System.String. > > > > How can I get the database types for the column, with the length > > specification? (SqlDbType.NVarChar, length constrain = 50). > > > > Thanks, > > Lubomir > |
|||||||||||||||||||||||