检索数据集中的数据库结构 [英] Retrieve database structure in dataset
本文介绍了检索数据集中的数据库结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,有人可以告诉我如何在具有主键列的数据集中检索数据库结构或如何获取不允许为空的列
thanx ...
Hi All , Can some one tell me how retrieve database structure in dataset with primary key columns or get the columns that not allow nulls
thanx...
推荐答案
使用DataReader可以做到.这是代码,-
Using DataReader you can do it. Here is the Code,-
scmd=new SqlCommand("select * from AdminUser",scon);
scon.Open();
sdr = scmd.ExecuteReader(CommandBehavior.KeyInfo);
sdr.Read();
dt = sdr.GetSchemaTable();
scon.Close();
希望对您有所帮助.
hope This can help you.
您始终可以向数据集中的表添加约束.请参见此处 [
You can always add a constraint to a table in a dataset. See here[^].
这篇关于检索数据集中的数据库结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文