Question Cannot connect to Database


New member
Apr 22, 2015
Programming Experience
Hi all,

I'm trying to connect to a MySQL database.
The information about Hostname, Username, password and database are in a textfile.
Is there a sollution to connect to the MySQL database and read the information from a text file.

sorry for my bad englisch, I'm a dutch one.

I'm Using Express 2013



VB.NET Forum Moderator
Staff member
Aug 17, 2004
Sydney, Australia
Programming Experience
You seem to think that the database has something to do with the text file. It doesn't. They are completely unrelated. Let's say that you wanted to bake a cake. Would the way you baked it depend on whether you you got the recipe from a book or on the internet or someone told you directly? Of course not. The recipe is the same regardless of how you get it, so how you bake the cake doesn't change. This is the same. How you connect to a MySQL database is the same regardless of where the connection information comes from.

You have two completely unrelated issues. You have a file that you want to read information from and that is done the same way regardless of what you intend to do with that information. You need to do some research on that specifically, without any regard for databases. Once you know how to read the data from the file, then you can use that data to connect to the database, which you can research independently of where the connection settings come from.

This is a crucial lesson to learn in programming: divide and conquer. Any problem you encounter is going to be a combination of smaller parts. The first task is to break the problem down into those smaller parts, and those into smaller parts again until you have the smallest units you can get. You then solve each of those small problems independently. When you fit all the small solutions together, you have inherently solved the original problem.
Top Bottom