如何使用MySQL asp.net? [英] how to use mysql with asp.net?

查看:131
本文介绍了如何使用MySQL asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用MySQL与我的Asp.Net应用程序,并想知道怎么办。我将使用MySQL的第一次。我想知道,最重要的是如何连接到MySQL数据库。


解决方案

您可以使用下面的ConnectionString在你的web.config连接到MySQL数据库:

 <&是connectionStrings GT;
  <添加名称=MySQLConnStr的connectionString =DRIVER = {MySQL的ODBC驱动程序3.51};数据库= YourDatabase;服务器=本地主机; UID =您的用户名; PWD =你的密码;/>
< /&是connectionStrings GT;

您需要尝试从ASP.NET连接到MySQL数据库之前做到以下几点:


  1. 确保您已经安装了.NET Framework的服务器上

  2. 下载ODBC .NET数据提供程序和开发机器或服务器上安装它。你可以在这里下载:<一href=\"http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1&DisplayLang=en\">http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1&DisplayLang=en

  3. 安装MySQL ODBC驱动的MyODBC 3.51。你可以在这里下载:<一href=\"http://dev.mysql.com/downloads/connector/odbc/3.51.html\">http://dev.mysql.com/downloads/connector/odbc/3.51.html

下面将完全向你解释ODBC的体系结构:

而对于更多的细节通过下面引用的文章:

从ASP.NET 连接到MySQL数据库

使用MySQL数据库(示例应用程序)

ASP.NET应用程序>

ASP.NET与MySQL - 入门

连接器/

NET范例

希望这有助于。

I want to use MySQL with my Asp.Net application and would like to know how. I am going to use MySQL for the first time. The most important thing I would like to know is how to connect to a MySQL database.

解决方案

You can use the following connectionstring in your web.config to connect to mysql database:

<connectionStrings>
  <add name="MySQLConnStr" connectionString="DRIVER={MySQL ODBC 3.51 Driver};Database=YourDatabase;Server=localhost;UID=YourUsername;PWD=YourPassword;"/>
</connectionStrings>

You need to do the following before attempting to connect from ASP.NET to MySQL database:

  1. Make sure you have installed the .Net Framework on your server
  2. Download the ODBC .Net data provider and install it on your development machine or your server. You can download it here: http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1&DisplayLang=en
  3. install MySQL ODBC Driver-MyODBC 3.51. You can download it here: http://dev.mysql.com/downloads/connector/odbc/3.51.html

The following will perfectly explain to you the architecture of ODBC:

And for more details go through following referenced articles:

Connect to MySQL database from ASP.NET

An ASP.NET Application Using a MySQL Database (Sample Application)

ASP.NET with MySQL - Getting started

Connector/NET Examples

Hope this helps.

这篇关于如何使用MySQL asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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