包括本地数据库的步骤 [英] step to include local database
问题描述
我正在从事学校管理项目.我要使用MS Access2003作为后端,并使用带有c#的visual studio2008进行编码.有人可以告诉我完整的过程(逐步设置).
I am working on School management project.i wana use MS Access2003 as backend and using visual studio2008 with c# for coding.can anyone plz tell me the complte procedure(setp by step).
推荐答案
用于Web应用程序
1)将数据库放在App_Data文件夹中
2)在web.config文件中设置连接字符串
for web application
1)place the database in App_Data folder
2) set the connectionstring in web.config file
<connectionstrings>
<add name="DbConnString" providername="Microsoft.Jet.OLEDB.4.0" connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\databasename.mdb" />
</connectionstrings>
3)在您的应用程序中使用以下连接进行数据库连接..
OleDbConnection con =新的OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings ["DbConnString"].ToString());
不要忘记在使用OleDbConnection的地方添加
使用System.Data.OleDb;
3) use below connection in your application for database connectivity..
OleDbConnection con = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DbConnString"].ToString());
dont forget to add where use OleDbConnection
using System.Data.OleDb;
试试这个链接会帮助你
http://www.c -sharpcorner.com/uploadfile/mimrantaj/connect-to-access-database-in-C-Sharp-and-ado-net/ [
Hi,
try this link it will help u
http://www.c-sharpcorner.com/uploadfile/mimrantaj/connect-to-access-database-in-C-Sharp-and-ado-net/[^]
Good Luck
这篇关于包括本地数据库的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!