Support - Knowledge base

Giving you the answers you need

Why not try our knowledge base for instant help and advice to enhance your online experience with Register365? From within the knowledge base you can browse our frequently asked questions and find the right answers to help solve your queries.

Home  >  Hosting  >  Windows Hosting  >  MSSQL Databases  >  View Article

How do I make a connection to an MSSQL database from ASP.NET

2*2*2*2*2*

Article

The code below should be sufficient for you to make a connection to your MSSQL database:

Note:Ensure you specify the correct host name (Data Source parameter) for the service your site is hosted on:


  • Namesco Ireland shared hosting - mssql.reg365.net

  • Namesco UK shared hosting - mssql.namesco.net

<%@ Import Namespace="System.Data" %>   
<%@ Import Namespace="System.Data.SqlClient" %>   
<script runat="server">  
sub Page_Load   
dim dbconn   
dbconn=New SqlConnection("Data Source=mssql.namesco.net;Database=dbname;User   
ID=username;Password=password")   
dbconn.Open()   
end sub   
</script>

Replace dbname,username and password with the appropriate details for your database.

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed