当前位置: 编程技术>.net/c#/asp.net
c#编程之设置DataGrid控件的标题栏
来源: 互联网 发布时间:2014-08-30
本文导语: c#编程之设置DataGrid控件的标题栏。 代码如下: 代码示例: void Page_Load() { string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;"; // strConnection += @"Data Source=C:Northwind.mdb"; strConnection += @"Data Source="+MapPath("EmployeeDat...
c#编程之设置DataGrid控件的标题栏。
代码如下:
代码示例:
void Page_Load()
{
string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
// strConnection += @"Data Source=C:Northwind.mdb";
strConnection += @"Data Source="+MapPath("EmployeeDatabase.mdb");
string strSQL = "Select LastName, FirstName, ID from Employee;";
OleDbConnection objConnection = new OleDbConnection(strConnection);
OleDbCommand objCommand = new OleDbCommand(strSQL,objConnection);
objConnection.Open();
dgEmps.DataSource = objCommand.ExecuteReader(CommandBehavior.CloseConnection);
dgEmps.DataBind();
}