Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2005, 08:16 AM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default use ODBCDataAdapter Connection MySQL

I saw this ODBCDataAdapter example in the MSDN.....
and I have tried it by the way that is like the SQLDataAdapte (ex SqlConnection conn=new SqlConnection("data source=localhost;initial catalog=dbmane;user id=as;password=pass")

but it didnt work.......
How can I use ODBCDataAdapter to connect to the database?

 
Old April 18th, 2005, 08:21 AM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OdbcConnection conn = new OdbcConnection(connection); //how use "connection"
OdbcDataAdapter adapter = new OdbcDataAdapter();
adapter.SelectCommand = new OdbcCommand(query, conn);
adapter.Fill(dataset);
 return dataset;

 
Old April 19th, 2005, 03:02 PM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ask oneself that answers by oneself
Have already solved this problem

using System.Data.Odbc;

OdbcConnection conn;
OdbcDataAdapter ap;
DataSet ds = new DataSet();
string constr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=TEST;UID=root;PW D=pass;OPTION=3";conn = new OdbcConnection(constr);
conn.Open();
ap = new OdbcDataAdapter(cmdstr,conn);
ap.Fill(ds,"MyTable");
this.dgMy.DataSource = ds;
this.dgMy.DataMember = "MyTable";






Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP connection to MySQL ells228 Classic ASP Databases 5 June 21st, 2017 01:38 PM
Java MySql Connection ruzdi Java Basics 21 May 14th, 2012 12:57 AM
C# and mySQL Connection naifwonder C# 5 March 8th, 2008 01:52 PM
DataSource connection with mysql joychand Struts 0 April 24th, 2007 10:19 AM
Mysql connection catab C# 4 December 7th, 2003 11:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.