how to write a connection string for Mysql  with asp.net2.0 using different connections.

Thanks in advance. 

6/6/2007 10:39:19 AM 1929 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 38

Using MyODBC its "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase;User=myUsername;Password=myPassword;Option=3;"

Using OleDbConnection its "Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;"

6/23/2007 9:36:24 PM

 I just thought of asking if you probably are having trouble switching databases when connecting to your mysql db.
Now, the good thing is MySQL provides a connector to, and you can download free of charge. For now, I assumed
that you have it and would like to connect to the db and switch to different db.

in your code, you could implement it like this:


1    Imports MySql.Data.MySqlClient
3    <script runat="server">
4    Dim objConnection As MySqlConnection
6    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
7     If objConnection("DynamicDBStringHere_yourdb_name_here") Then
8        '.. do what you want in here
9     End If
10   End Sub
12   Function ConnectDB(ByVal dbName As String) As Boolean
13     objConnection = New MySqlConnection("data source=localhost; database=" & dbName & "; username=user;password=pass;")
15     Try
16       objConnection.Open()
17     Catch ex As MySqlException
18       Response.write(ex.Message.ToString()
19     End Try   
20   End Function
21   </script>

 don't forget to copy the MySql connector dll in your /bin directory. Good luck!



Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own commonsense. ---Buddha (563BC-483BC)
6/25/2007 2:31:17 AM

Similar Artilces:

Currently have a site coded in PHP but the customer wants to go to .NET. Can I use the existing MySQL DB or am I required to use MSSQL? Thanks, Ken Check out this forum which is specialized for this kind of questions: ASP.NET MySQL forumBart De Smet [MVP] Visit,

mysql php5-mysql
Hi, i have installed mysqk from binaries itworks!!! but now how can i install php5-mysql and dependencies? Many thanks Thierry -- trazomtg ------------------------------------------------------------------------ When you say from the binaries, do you mean you installed via Yast and the Suse repositories?? It is always best to install via Yast-Software-Software Management if you can. This way all dependencies are done for you. -- gogalthorp ------------------------------------------------------------------------ gogalthorp's Profile: http://forums.opensuse....

linked server MySql to Mysql
Can i make linked server from MySql to another Mysql server?...

mysql and .net
Hi there, i am new to .net and i am trying to setup a simple form. I am an open source person and what i am asking can be done easily using php and mysql; but i need to know how to do this in .net project asap. i have three forms; form1 submit to the database and redirect to form2 and form2 submit to the database and redirect to form3. i want to grab mysql last inserted id from form1 to form2 while redirecting and pass it via the url. i am able to select from the database, but i don't know how to assign it to a variable; here is what i have so far: str2 = "select last_ins...

Suse MySQL and MySQL workbench
I am looking at the downloads here 'MySQL :: Download MySQL Workbench' ( and 'MySQL :: Download MySQL Community Server' ( As one is source code and the other is suse enterprise linux, are these the best downloads for MySQL on suse 11.3? Is there a best source for the install? Suse specific rpm's? -- flebber ------------------------------------------------------------------------ Try zypper or YAST first to look at the OpenSuSE repositories. ...

------=_NextPart_000_0026_01C30A6E.486AE070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Anyone run into this problem=20 $mysql->query(q{ INSERT INTO dbname (table_name) VALUES ( $var ) }); The problem is, when I assign a value to a $var that value is ignored in = the SQL statement. Ive tried every operator I know to get it to look at = it and accept the value as input into the DB. Ive tried=20 ( '$var' ) ("$var") ("\$var") ([$var]) ({$var}) Any ideas ? Kind regards...

Perl Mysql
Hi all, I am installing Bugzilla3 on a windowsXP box together with Mysql5.0.45 and ActivePerl- It passed the checksetup and created the database. However, when I point my Firefox to http://localhost/ I got the following error: install_driver(mysql) failed: Can't load 'C:/Perl/site/lib/auto/DBD/mysql/mysql.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/Perl/lib/ line 230. at (eval 34) line 3 Compilation failed in require at (eval 34) line 3. Perhaps a required shared library or dll isn't installed...

DBD::mysql bad auto/DBD/mysql/mysql.bundle file on OS X
Howdy group :) Having a bit of trouble getting DBD::mysql installed on OS X I get this error: root# perl -e 'use DBD::mysql;' Can't load '/Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: /Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle(2): Not a recognisable object file at -e line 1 Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1. root# Here is what is in the directory: root# ls /Library/Perl/5.8.1/darwin-thread-multi-2level/au...

Have ASE 12.5 on Linux box with the Rep Server on the box as well. Another part of the org want to rep data from ASE to MYSQL. Although Sybase Rep does not support Mysql...I thought through the ODBC connector it would. Please help Your thinking is wrong! > Have ASE 12.5 on Linux box with the Rep Server on the box > as well. Another part of the org want to rep data from > ASE to MYSQL. Although Sybase Rep does not support > Mysql...I thought through the ODBC connector it would. > Please help ...

Can I use MySQL as database or am I limited to Access and MSSQL? Hi, You can use database other than Access / MSSQL in ASP.NET, FYI: view post 249017 and view forum 56 Colt...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib service mysql start Starting service MySQL warning: /var/lib/mysql/mysql.sock didn't appear within 3 need help thanks -- ansonelliott ------------------------------------------------------------------------ Have you ensured both mysqld and apache are running? YaST > System > System services (if I remember correctly) allows you to set both to start automatically on boot. -- john_hudson -----------------------------------------------------------------------...

Anyone using PB with MySQL as their database? Just about everything is going fine except the current ODBC driver doesn't support cursors which we're having some difficulty getting around for one function of our program. Terrill ...

Please, Mobilink support the SGBD MySQL ??? thanks MySQL is not an officially supported (nor tested) consolidated database. The issue is that the ODBC drivers available for MySQL do not support the level of ODBC functionality or aren't stable enough for ML's needs. Some people have reported different levels of success using MySQL as a consolidated either directly using different ODBC drivers or by using ASA as the consolidated and proxy tables to the MySQL backend. -- Liam Cavanagh Certified ASA Developer Version 8 iAnywhere Solutions - Sybase Product Managem...

Hi, Well, I'm about to take the plunge and begin to learn MySQL. I have Apache and Perl all running great (stock installs), but I'm not sure how to get started with installing MySQL. I guess what I'm asking is, can some one share some good links/pointers on installing MySQL. As well, links on USING MySQL with Perl. I'm not planning on doing any huge things with multiple databases, just some basic info to be stored and then searched through when needed. I could do what I need in a flat file DB, but want to learn how to use MySQL. Any pointers anyone could ...

Web resources about - Mysql -

MySQL :: The world's most popular open source database
“MySQL's reliability and speed have helped us develop software that maximizes the availability and performance of enterprise telephony networks, ...

MySQL :: Il database open source più diffuso al mondo
Skip navigation links Il database open source più diffuso al mondo Contatta un rappresentante MySQL Login - Registrazione Download (GA) ...

MySQL Performance Blog
Percona's blog about MySQL performance optimization and scalability, InnoDB, XtraDB, and XtraBackup

MySQL - Wikipedia, the free encyclopedia
5.5.27 / August 2, 2012 ; 29 days ago ( 2012-08-02 ) The MySQL development project has made its source code available under the terms of the ...

It is that time of the year, again: Percona Live is the name of this years MySQL conference in the Santa Clara Hyatt Regency. is ...

MySQL Consulting and NoSQL Consulting: MySQL DBA
... to the problem that doesn't include companies having to buy new software tools or even an all-new database: With the right expertise, MySQL ...

MySQL Bugs
Portions of this website are copyright © 2001, 2002 The PHP Group Page generated in 0.013 sec. using MySQL 5.5.16-enterprise-commercial-advanced-log ...

MySQL :: Developer Zone
"The Documents contained within this site may include statements about Oracle's product development plans. Many factors can materially affect ...

MySQL Forge :: Dashboard
© 1995-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2012, Oracle Corporation and/or its affiliates. Content reproduced on this site is the ...

Facebook, Google, LinkedIn, Twitter Team Up On WebScaleSQL To Tackle MySQL Challenges
Facebook, Google , LinkedIn , and Twitter face similar challenges in working with open-source database MySQL , and Thursday, the four companies ...

Resources last updated: 1/9/2016 4:02:12 AM