How do I connect to my database via .NET?

Hostverge Support

Last Update a year ago

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:


MySQL

  • 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);


MSSQL

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.

Was this article helpful?

0 out of 0 liked this article