Friday, March 9, 2012

get the name of the field?

How do I get The head of the field of my database. I have a Database which has 5 field. I would like to get the name of the field and bind it to a label.
how do i do that??Do you want get column names of a table?
Use system stored procedure sp_help table_name, or use data reader object's member drObj.GetName(I), I is the zero based column ordinal, etc.|||I would like to get the column name of sql DB. I have several tables in DataBase and I would like to do SELECT* to one of the table. Once I did that I want to present the data in a repeater when I am puting in the header of the repeater the name of the columns.|||you need to study Select * From SysColumns|||Dose a SysColumns is a system table?

How can I get the name of a specific columns form syscolumns?|||Hi, wangwei,

Try this in Query Analyzer

select C.name from syscolumns c
join sysObjects O
on C.id = O.id
where O.name = 'Table_name'
and colid = 3

-- here colid is the column Id starting from 1

Hope this helps.|||

dhjiang:

Do you want get column names of a table?Use system stored procedure sp_help table_name, or use data reader object's member drObj.GetName(I), I is the zero based column ordinal, etc.

Thanks this is just what I needed.

No comments:

Post a Comment