|
|
|
Список полей в DataTable.
|
|||
|---|---|---|---|
|
#18+
Всем привет! У меня вопрос. Как получить список полей в таблице не загружая данных? Можно конечно так: SqlConnection cnn=new SqlConnection(GetConnectionString()); SqlCommand cmd = new SqlCommand(); DataSet ds = new DataSet(); cmd.CommandText = "SELECT * FROM " + tablename; cmd.CommandType = CommandType.Text; cmd.Connection = cnn; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds, tablename); foreach(DataColumn col in ds.Tables[tablename].Columns) { Console.WriteLine(col.ColumnName); } Но хотелось бы получить только структуру таблицы. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.01.2006, 10:15 |
|
||
|
Список полей в DataTable.
|
|||
|---|---|---|---|
|
#18+
Код: plaintext 1. 2. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.01.2006, 10:29 |
|
||
|
|

start [/forum/topic.php?fid=17&msg=33510005&tid=1353460]: |
0ms |
get settings: |
6ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
38ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
27ms |
get tp. blocked users: |
1ms |
| others: | 193ms |
| total: | 287ms |

| 0 / 0 |
