C 返回某張表的所有欄位名

2021-04-30 00:33:04 字數 560 閱讀 8176

// 定義必要的變數

private sqlconnection sqlconn;

private sqldataadapter sqlda1;

private sqldataadapter sqlda2;

private sqlcommand sqlcomm;

private system.data.sqlclient.sqldatareader dr;

//初始化變數

sqlconn.connectionstring="字串"

sqlconn.open();

sqlcomm.commandtext="select * from 表名";

sqlcomm.commandtype=commandtype.text;

sqlcomm.connection=sqlconn;

dr=sqlcomm1.executereader();

//取字段

string s;

for(int i=0;i<=dr.fieldcount-1;i++)

...

mysql獲取某個表的所有欄位名

mysql安裝成功後可以看到已經存在mysql information schema和test這個幾個資料庫,information schema庫中有乙個名為columns的表,這個表中記錄了資料庫中所有表的字段資訊。知道這個表後,獲取任意表的字段就只需要一條select語句即可。例如 selec...

mysql獲取某個表的所有欄位名

mysql安裝成功後可以看到已經存在mysql information schema和test這個幾個資料庫,information schema庫中有乙個名為columns的表,這個表中記錄了資料庫中所有表的字段資訊。知道這個表後,獲取任意表的字段就只需要一條select語句即可。例如 selec...

mysql獲取某個表的所有欄位名

mysql安裝成功後可以看到已經存在mysql information schema和test這個幾個資料庫。information schema庫中有乙個名為columns的表,這個表中記錄了資料庫中所有表的字段資訊。知道這個表後,獲取任意表的字段就只需要一條select語句即可。例如 selec...