DataReader Binds to DataGrid controls

xiaoxiao2021-03-06  24

// definition database link object SqlConnection mycon = new SqlConnection (ConfigurationSettings.AppSettings [ "connstring"]); // connstring upper connection string SqlCommand mycmd = mycon.CreateCommand () is a database in web.config; mycmd.CommandText = " Open the statement of the database "; try {mycon.open (); sqldataareader mydr = mycmd.executeReader (); dataGrid.datasource = mydr; datagrid.database ();} finally {mycon.disponse (); // Turk database link}

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

New Post(0)