Web Design & Development, Branding & Marketing Delivering by a leading Birmingham Agency

Share this

How do I connect to my database via .NET?

How do I connect to my database via .NET?

A website built using .NET can be connected to databases of different types: MySQL, MSSQL, and Access databases.

You need to use a specific connection string to connect to each database type:


  • Driver={MySQL ODBC 5.3 Unicode Driver}; Server=(MySQL hostname); Port=; Option=0; Socket=; Stmt=; Database=(MySQL database name); Uid=(MySQL username); Pwd=(the password for the MySQL user);


A driver need not be specified when connecting to an SQL database:

  • Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Access Database

  • Driver={Microsoft Access Driver (*.mdb)};” & _ “DBQ=\\path_to_.mdb_file

As long as the placeholders in the above are replaced with your actual database connection details, it should allow a connection to the database.