我如何将我的项目与数据库连接 [英] how could i connect my project with database

查看:128
本文介绍了我如何将我的项目与数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何将我的项目与数据库连接

how could i connect my project with database

推荐答案

嗨anusha504,

首先,您需要了解以下各种数据库访问的连接字符串
http://connectionstrings.com/ [ ^ ]

然后再参考以下链接:
http://www.w3schools.com/aspnet/aspnet_dbconnection.asp [ http://msdn.microsoft.com/en-us/library/ms178371.aspx [ ^ ]
从.NET应用程序连接到MySQL数据库. [在ASP.NET Web应用程序中查找泄漏的"数据库连接 [
Hi anusha504,

very first you need to understand for connection string for different kinds database access which are given below
http://connectionstrings.com/[^]

and after that refer below links also:
http://www.w3schools.com/aspnet/aspnet_dbconnection.asp[^]
http://msdn.microsoft.com/en-us/library/ms178371.aspx[^]
Connecting to MySQL database from your .NET applications.[^]
Find "Leaked" Database Connections in ASP.NET Web Applications[^]


连接的方法太多到数据库
几个
1)使用sqlclient并手动使用命令..
2)使用类型数据集
3)linq to sql
there are too many methods to connect to database
few of them
1)use sqlclient and use manually commands..
2)use type dataset
3)linq to sql


将您的连接字符串存储在web.config的连接字符串设置"部分中

< connectionstrings>
<添加名称=连接名称" connectionstring =数据源= .;初始目录= Dbname;用户ID = sa;密码= 123456">



并在您的网页中访问它,例如
Store your Connection string in web.config''s Connectionstring Setting Section

<connectionstrings>
<add name="connectionname" connectionstring="Data Source=.;Initial Catalog=Dbname;User ID=sa;Password=123456">



and access it in your Web Page like
string con= ConfigurationManager.AppSettings["connectionname"]




寻求更多帮助
连接字符串




for more help
connection string


这篇关于我如何将我的项目与数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆