473,396 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to connect MySQL database to VB2005 at design time?

nev
251 100+
Can anyone tell me the steps how to do this or direct me to a link? I connect MySQL during runtime. I was wondering if its possible during design time so that I can use the IDE to manage all my MySQL tables.
Oct 18 '07 #1
7 4896
Dököll
2,364 Expert 2GB
Can anyone tell me the steps how to do this or direct me to a link? I connect MySQL during runtime. I was wondering if its possible during design time so that I can use the IDE to manage all my MySQL tables.
Hiya, Nev!

It's likely you have tried this already, but there are some amazing videos I've seen with examples on connecting to SQL Server, might be able to mix it up to make it do what you need for MySQL:

http://msdn2.microsoft.com/en-us/express/aa718409.aspx

If this does not work for you, please stay tuned!

Also, Welcome!

Dököll
Oct 18 '07 #2
nev
251 100+
Hiya, Nev!

It's likely you have tried this already, but there are some amazing videos I've seen with examples on connecting to SQL Server, might be able to mix it up to make it do what you need for MySQL:

http://msdn2.microsoft.com/en-us/express/aa718409.aspx

If this does not work for you, please stay tuned!

Also, Welcome!

Dököll
Thank you! I'll check out the link.
Oct 18 '07 #3
nev
251 100+
Hi dokoll, I checked out the link but it only talks of Microsoft's SQL Server. This can be done because when I click the 'Add Datasource', I can select SQL Server from the list. For MySQL however, it doesn't appear in the list that's why I can't select it. How will I 'Add Datasource' MySQL database using the IDE so that I can use for example the Query Designer?
Oct 18 '07 #4
thelner
13
Hey nev,

I just started learning vb.net and mysql today and this site is really helping me a lot. They have an artice on vb.net and mysql.
Oct 18 '07 #5
nev
251 100+
Hey nev,

I just started learning vb.net and mysql today and this site is really helping me a lot. They have an artice on vb.net and mysql.
thaksn for the input.
Jan 28 '08 #6
Download MySQL Connector Net 5.0.8.1

Start a new project and add a reference to Microsoft Active Data Objects 2.x.
Project -> Add Reference -> COM tab -> Microsoft Active Data Objects 2.x

Modify the code to suit your needs.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.         Dim conn As New ADODB.Connection
  4.         Dim rs As New ADODB.Recordset
  5.         Dim mysql_server As String = "localhost"
  6.         Dim db As String = "database_name"
  7.         Dim user As String = "user_name"
  8.         Dim pass As String = "password"
  9.         Dim sql As String
  10.         Dim fields As Array
  11.         Dim i As Integer
  12.  
  13.         Try
  14.             conn.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=" & mysql_server & ";Database=" & db & ";User=" & user & ";Password=" & pass & ";Option=3;"
  15.             conn.Open()
  16.  
  17.             sql = "SELECT FirstName, LastName FROM tbladdresses ORDER BY FirstName;"
  18.             rs.Open(sql, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
  19.  
  20.             fields = rs.GetRows
  21.             rs.Close()
  22.         Catch ex As Exception
  23.             MsgBox("Connection string is incorrect.")
  24.             Exit Sub
  25.         End Try
  26.  
  27.         For i = 0 To UBound(fields, 2)
  28.             Debug.Print(fields(1, i))
  29.         Next
  30.  
  31.         conn.Close()
  32.     End Sub
  33. End Class
  34.  
Jan 28 '08 #7
Sorry, I misunderstood the question with my previous post. Why not download the QueryBrowser?

http://www.mysql.com/products/tools/query-browser/
Jan 28 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Eric W. Holzapfel | last post by:
Hello PHP group, I have mysql running on a linux box. I have apache (2.0.4) running on a diff linux box. I have php 4.X. I can connect to the mysql db using odbc from a windows box, but...
1
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to...
1
by: malcolm | last post by:
Hello, We use several user controls and derived custom controls. Some of which actually hit the database at design time to show data (such as filling a list box, etc...) Our c# client server...
14
by: mistral | last post by:
Need php script to create mySQL database programmatically; since hosting configuration may not allow create database from script, script also need eliminate/rewrite all restrictions in appropriate...
2
by: basestring | last post by:
Hi I am busy now for many hours without luck I have a database and when I use PHP to add date to it, it works only one time when i want to add the next data, It doesn't work. but i don't get any...
8
by: menmysql | last post by:
i am not bale to solve this problem since two weeks i am trying to access records from mysql database using jsp. inside this jsp program i wrote all my JDBC code. it is working very nicely and...
3
by: likigoldenstar | last post by:
Hi, I have some problem in developing program using PHP. I 'll explain my platforms: I use appserv-win32-2.5.9 as a app server. In the server, mysql client version is 5.0.37 Problems:
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
2
by: vaishalinagare | last post by:
when i try to connect mysql database with vb 6.0 i got error Data source name not found and no default driver specified. i'm trying to connect remote database.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.