index.aspx
复制代码 代码如下:
<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
// Insert page code here
//
void Page_Load(){
string db=@"database/data.mdb";
string connStr="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="+Server.MapPath(db)+";";
string SQLcmd="create table IEB_webs(ID identity primary key,title varchar(255) Default Null)";
OleDbConnection conn=new OleDbConnection(connStr);
conn.Open();
OleDbCommand OleCmd=new OleDbCommand(SQLcmd,conn);
OleCmd.ExecuteNonQuery(); //执行SQL命令
Response.Write("数据表建立完成!");
}
conn.Close();
conn=null;
OleCmd=null;
}
</script>
<html>
<head>
</head>
<body>
<form method="post" runat="server">
<!-- Insert content here -->
</form>
</body>
</html>
复制代码 代码如下:
<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
// Insert page code here
//
void Page_Load(){
string db=@"database/data.mdb";
string connStr="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="+Server.MapPath(db)+";";
string SQLcmd="create table IEB_webs(ID identity primary key,title varchar(255) Default Null)";
OleDbConnection conn=new OleDbConnection(connStr);
conn.Open();
OleDbCommand OleCmd=new OleDbCommand(SQLcmd,conn);
OleCmd.ExecuteNonQuery(); //执行SQL命令
Response.Write("数据表建立完成!");
}
conn.Close();
conn=null;
OleCmd=null;
}
</script>
<html>
<head>
</head>
<body>
<form method="post" runat="server">
<!-- Insert content here -->
</form>
</body>
</html>
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“ASP.NET 连接ACCESS数据库的简单方法”评论...