| TechTasks.net |
The Blog is Moved to www.TechTasks.net
MySQL and ODBC
A more supported format for connecting to MySQL from a C# .NET web application is by using the common ODBC driver. First, you will need to install the MySQL ODBC driver http://www.mysql.com/products/connector/odbc on your PC. This same driver (MyODBC) is usually installed on most web servers. As such, you may have no other choice except to use ODBC for connecting to MySQL.
Connecting to the MySQL database from your C# ASP .NET web application using ODBC is very similar to the above example. You just change a small part of each command definition from MySQL to Odbc.
using System.Data;
using System.Data.Odbc;
public partial class odbc : System.Web.UI.Page
{
static string s = "driver={Mysql odbc 3.51 driver}; sever =localhost; user id=root;password=admin;database=temp;option=3";
OdbcConnection con = new OdbcConnection(s);
protected void Page_Load(object sender, EventArgs e)
{
OdbcDataAdapter da = new OdbcDataAdapter("select * from emp", con);
DataSet ds = new DataSet();
da.Fill(ds, "emp");
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
Blog Archive
-
▼
2008
(33)
-
►
December
(14)
- Non Editable Rows in GridView
- Validate DropDownList inside GRIDVIEW
- .Net Keyboard Shortcuts
- Grid View Operataions
- FAQ'S & INTERVIEW TIPS
- C#.NET
- ASP.NET
- DOTNET FRAMEWORK
- Projects With Source Code
- Enter Text In Into Two TextBoxes At the Same Time
- Saving Uploaded file into Disk and displaying the ...
- Writing Connection string in web.config file
- Change GridView Row Color When MouseOver
- Working With Command Builder in ASP.NET
-
▼
November
(14)
- JavaScript Validatoin For Basic Controles in ASP.N...
- Dot Net - C#.Net(FAQ'S)
- Dot Net - Asp.Net - Basic II(FAQ'S)
- Dot Net - Asp.Net - Basic I(FAQ'S)
- Famous Books For .NET
- Connecting MySql With Asp.net Using ODBC Drivers
- Simple Calculator In Windows Application Using C#
- Mail Sending Using Net.Mail
- Select All And Delete Using CheckBox In GridView
- GridView DeleteAll,SelectAll,ClearAll(Server Side)...
- GridView Paging & Sorting
- GridView Update,Delete,Adding (Insert) Record...
- Alphabetical Paging in Gridview
- Connecting MySql With C# ASP.NET
-
►
December
(14)


1 comments:
Hi guys, my names Eva and im completely new to this forum.
I hope that I'll learn and share a lot of interesting things.
Thanks,
Eva