Loading

Connect to system database with .INI file

Submitted by: 


Connecting Visual Basic 6.0 to MySql Database.
Here is how. Install MySql Datasbe on you local machine, configure it well and by using localhost, root, root,
Here is the VB6 Connecting to MySql Databse:

  1. Public Function connectionString()
  2. connectionString = "DRIVER={" & ReadIniValue(App.path & "\Config.ini", "DEFAULT", "DRIVER") & "};" _
  3. & "SERVER=" & ReadIniValue(App.path & "\Config.ini", "DEFAULT", "HOST") & ";" _
  4. & "DATABASE=" & ReadIniValue(App.path & "\Config.ini", "DEFAULT", "DBNAME") & ";" _
  5. & "UID=" & ReadIniValue(App.path & "\Config.ini", "DEFAULT", "UID") & ";" _
  6. & "PWD=" & ReadIniValue(App.path & "\Config.ini", "DEFAULT", "PWD") & ";" _
  7. & "OPTION=3"
  8. End Function

-as you notice, here in this code I used a config file. If you have any questions on my config file, you can proceed or click here for sample code on creating config.ini.
-If you don't want to use any preconfigured file. you can use the traditional way in connecting to mysql, but I highly suggest you to use preconfigured file, just in case if you are connecting to a remote server, where unexpected connection settings will be change. This is just to avoid the redundant changes on your code.

So...... lets proceed....

Visit http://www.jackjones2010.blogspot.com for more info.




Comments

I'm really impressed to the author for this site and to all the programmer here..keep up the good work..ciao!!

can u give me, sample on visual basic 2008. it's very important for me. thq b4.

Sorry to inform you that currently I do not used Visual Basic 2008, I only used Visual Basic 6, and PHP/Javascript on web development. Anyway I have some samples like this in PHP. If you want.

sir kevern010101 can u give us sample program of ur post? thank u so much

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.