如何在MSAccess中使用conncetion字符串

编程入门 行业动态 更新时间:2024-10-25 02:31:08
本文介绍了如何在MSAccess中使用conncetion字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在sql中使用连接字符串我保存了数据。所有记录都在数据库中。 i希望MS Access数据库在MS Access中存储记录数据库。 Sql conncetion字符串如下; private string himtConnectionString =Data Source = india; connect timeout = 120; Initial Catalog = HIMTTESTing; User ID = sgv; Password = s123; 如何为MS Access数据库写连接字符串。 private string Accessconncetionstring =Provider = microsoft.jet.OLEDB.4.0; Data Source = C:\ HIMTTESTing.mdb; 上面的MS Access Accessconncetionstring是正确的。请帮助我。 我该怎么办。 i不知道。请帮助我。我想要答案。

using connection string in sql i saved the data.All records are there in the data base. i want to MS Access Database to store the record in MS Access DataBase. Sql conncetion string as follows; private string himtConnectionString = "Data Source=india;connect timeout = 120; Initial Catalog=HIMTTESTing;User ID=sgv;Password =s123 "; how to write connection string for MS Access Data Base. private string Accessconncetionstring = "Provider = microsoft.jet.OLEDB.4.0;Data Source=C:\HIMTTESTing.mdb"; the above Accessconncetionstring for MS Access is correct.please help me. how can i do. i don''t know.please help me.i want the answer.

推荐答案

MS Access 2007数据库的连接字符串也可以存储insid使用C#将web.config文件连接到ASP.Net网页。在MS Access 2007中,Microsoft引入了一种新的数据库文件类型,即.accdb扩展名。 MS Access 2007的内部功能可以像以前的版本一样正常执行。您可以创建MS Access数据库并将其保存到ASP.Net Web应用程序的App_Data目录中。 App_Data目录也是ASP.Net 2.0框架的一项新功能,使您可以将其中的数据项存储为无法使用http请求公开访问的安全项。可以使用ASP.Net框架的OleDb数据提供程序连接MS Access 2007数据库,使您可以轻松地使用C#代码连接和执行数据操作。 The connection string for MS Access 2007 database can also be stored inside the web.config file to connect it to the ASP.Net web page using C#. In MS Access 2007 the Microsoft has introduced a new database file type that is .accdb extension. The internal features of the MS Access 2007 can be performed normally like in the previous versions. You can create the MS Access Database and save it into the App_Data directory of the ASP.Net web application. The App_Data directory is also a new feature of ASP.Net 2.0 framework that enables you to store the data items inside it as secure items that cannot be accessed using http request openly. The MS Access 2007 database can be connected using the OleDb data provider of ASP.Net framework that enables you to connect and perform the data operations using C# code easily. <connectionStrings> <!-- connection string declared for connecting the web application with MS Access 2007 --> <!-- connection string for MS Access 2007 accdb file --> <add name="AccessConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|db1.accdb;Persist Security Info=False;Jet OLEDB:Database Password=;" providerName="System.Data.OleDb" /> </connectionStrings>

用于将网页连接到MS Access 2007数据库文件的C#代码 名称空间必需

C# Code for Connecting the Web Page to MS Access 2007 Database File Namespace Required

// import the following namespaces using System.Configuration; using System.Data; using System.Data.OleDb;

// create an OldDbConnection object and initialize it by passing connection string. // ConfigurationManager class provides the ConnectionStrings collection type property // to access the connection string stored in the web.config file. OleDbConnection myDataConnection = new OleDbConnection(ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString); // open the data connection. myDataConnection.Open(); // display the connection's current state open/closed. Response.Write(string.Format("<i><b>Connection state:</b> {0}</i><br />", myDataConnection.State)); // close the data connection. myDataConnection.Close(); // again display the connection's current state open/closed. Response.Write(string.Format("<i><b>Connection state:</b> {0}</i>", myDataConnection.State)); // dispose the connection object to release the resources. myDataConnection.Dispose();

更多推荐

如何在MSAccess中使用conncetion字符串

本文发布于:2023-10-27 02:54:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532098.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   如何在   MSAccess   conncetion

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!