Get database table structure

xiaoxiao2021-03-06  52

DataSet DS = New DataSet ();

System.data.sqlclient.sqlconnection cnn = new system.data.sqlclient.sqlconnection ("Server = (local); database = northwind; trusted_connection = yes"; cnn.open ();

System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand (); cmd.Connection = cnn; cmd.CommandText = "Select * from PersonDetails where 1 <> 1"; System.Data.SqlClient.SqlDataReader dr = cmd.executeReader (system.data.commandbehavior.closeconnection); this.DataGrid1.datasource = Dr.getschematable (); cnn.close (); Dr.Close ();

转载请注明原文地址:https://www.9cbs.com/read-119815.html

New Post(0)