Connect to an SQL server from my ASP.net page

Hi, I’m hoping someone can help me.

I have an ASP.net website posted to a domain I purchased on domain.com
Domain.com also provides me with the ability to create databases with SQL.

I’ve created a database called db_Main which contains a table called MainTable.

I need to know how to connect to this database so that I can display the records on my website, and eventually allow users to add additional records to the database from my website.

Domain.com provides the following code to connect to the database, I’m not sure where I put this though. Can someone help me?

’ Code for ODBC 3.51
’ Start
<%
Dim ConnectionString
ConnectionString=“DRIVER={MySQL ODBC 3.51 Driver}; SERVER=MyServerAddress(not posting it here); PORT=#### (they provide the number not posting it here);” &_
“DATABASE=db_main; USER=MyUserName(not posting it here); PASSWORD=(the password, not posting it here); OPTION=3;”
%>
’ End

’ Code for ODBC 5.1
’ Start
<%
Dim ConnectionString
ConnectionString=“DRIVER={MySQL ODBC 5.1 Driver}; SERVER='MyServerAddress(not posting it here); PORT=#### (they provide the number not posting it here);” &_
“DATABASE=db_main; USER=MyUserName(not posting it here); PASSWORD=(the password, not posting it here); OPTION=3;”
%>
’ End

There are different types of SQL databases and it looks like you’re trying to use a MySQL database with your ASP.NET website. If you Google something like “using MySQL with ASP.NET website”, you should see some links come up on how to configure the application to connect to the database and run queries against it to save and retrieve your data.

Hi Bubby visit this useful Article.I hope it will help you

Add connection string of SQL server in asp.net page

Use and connect to MySQL Database in ASP.Net Application using MySQLConnector