Here you will find two code examples that show you how to connect to an MSSQL database with VB.NET or C#.

You will find the database connection details in IONOS by selecting Hosting, then Manage from the MSSQL Databases section.


The example shows the use of the connection object in ADO:

Set ConnHandle = Server.CreateObject("ADODB.Connection")
ConnHandle.Open "driver={SQL Server};;

Note: Replace the sample data for server, uid, pwd and database with those of your database.

For more information about using the connection object, see the Microsoft Developer Network (msdn): How Do I Use the Connection Object in ADO?


In this example, a DSN Less connection is established via the SqlConnection object:

SqlConnection makeSQLConn = new SqlConnection("Persist Security Info=False;;
Initial Catalog=db12345678; User ID=dbo12345678;

For more information about using the SqlConnection class, see the Microsoft Developer Network (msdn): SqlConnection Class