Protected system.web.ui.webcontrols.dataGrid DataGrid1;
Private Void Page_Load (Object Sender, System.EventArgs E)
{
// Write a method:
// String Connectionstring = "Server = 172.24.17.134; user ID = sa; pwd = testpass; database = testdb";
// Writing 2:
// String Connectionstring = "Server = HD-Server; user ID = sa; pwd = testpass; database = testdb";
// Write three:
// String Connectionstring = "Server = (local); user ID = sa; pwd = testpass; database = testdb";
String Connectionstring = "Server = (local); user ID = sa; pwd = testpass; database = testdb";
String strsql = "SELECT * from TABLE_1";
SqlConnection Conn = New SqlConnection (Connectionstring);
Sqlcommand cmd = new SQLCOMMAND (strsql, conn);
cmd.connection.open ();
SqlDataReader DR = cmd.executeRead ();
DataGrid1.datasource = DR;
DataGrid1.databind ();
cmd.dispose ();
Dr.close ();
cmd.connection.close ();
cmd.connection.dispose ();
}