asp.net(c#)连接ACCESS数据库
来源:互联网 发布:全景天窗的优缺点 知乎 编辑:程序博客网 时间:2024/04/30 12:52
<%@ Page Language="c#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
string strConnect;
string strCommand;
DataSet DataSet1 = new DataSet();
strConnect = @"Provider=Microsoft.Jet.OLEDB.4.0;";
//If you don't have the grocertogo.mdb database, then you will have to
//change the following three lines to a different database
strConnect += @"Data Source=D:/aspx/db";
strConnect += @"/grocertogo.mdb;";
strConnect += "Persist Security Info=False";
strCommand = "SELECT ProductName, UnitPrice FROM products";
objConnection = new OleDbConnection(strConnect);
objCommand = new OleDbDataAdapter(strCommand, objConnection);
objCommand.Fill(DataSet1, "products");
DataGrid1.DataSource=DataSet1.Tables["Products"].DefaultView;
DataGrid1.DataBind();
}
</script>
<html>
<head>
<title>Data Grid Control example</title>
</head>
<body>
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
</body>
</html>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
string strConnect;
string strCommand;
DataSet DataSet1 = new DataSet();
strConnect = @"Provider=Microsoft.Jet.OLEDB.4.0;";
//If you don't have the grocertogo.mdb database, then you will have to
//change the following three lines to a different database
strConnect += @"Data Source=D:/aspx/db";
strConnect += @"/grocertogo.mdb;";
strConnect += "Persist Security Info=False";
strCommand = "SELECT ProductName, UnitPrice FROM products";
objConnection = new OleDbConnection(strConnect);
objCommand = new OleDbDataAdapter(strCommand, objConnection);
objCommand.Fill(DataSet1, "products");
DataGrid1.DataSource=DataSet1.Tables["Products"].DefaultView;
DataGrid1.DataBind();
}
</script>
<html>
<head>
<title>Data Grid Control example</title>
</head>
<body>
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
</body>
</html>
- asp.net(c#)连接ACCESS数据库
- asp.net(C#)连接access数据库
- asp.net连接Access数据库
- asp.net连接Access数据库
- asp.net连接Access数据库
- asp.net连接Access数据库
- ASP.NET连接Access数据库
- ASP.Net 连接ACCESS数据库
- ASP.NET连接Access数据库
- ASP.NET连接Access数据库
- asp.net连接Access数据库
- ASP.net连接access数据库
- asp.net连接Access数据库
- asp.net连接Access数据库
- ASP.NET连接Access数据库
- asp.net 连接access数据库
- ASP.NET连接Access数据库
- Asp.net 连接Access数据库
- Performance Improvement in ASP.NET using Caching
- 各种ADSL猫初始地址及用户名密码
- 摘自ado的item方法
- 实体关系模型, 概念模型,Domain Model, UML建模(*** Diagram) --- 有点晕
- 智能客户端离线程序块(SCOAB)Demo Show
- asp.net(c#)连接ACCESS数据库
- 从recordset对象提取数组形式数据,
- Ant介绍
- 突破大龄障碍,找到适合的岗位
- 设计数据层组件并在层间传递数据
- 我最近写的,取名叫做:FileMon记录分析助手,很管用!
- asp.net(C#)连接xml,显示数据。
- 吃饭不积极,哪里有问题?
- 一些好用的Eclipse 3.0插件