# Connect to an SQL server from my ASP.net page

**URL:** <https://forum.freecodecamp.org/t/connect-to-an-sql-server-from-my-asp-net-page/26201>\
**Category:** General\
**Created:** [August 7, 2016, 10:06pm UTC](https://forum.freecodecamp.org/t/connect-to-an-sql-server-from-my-asp-net-page/26201 "2016-08-07T22:06:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![markcorp](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@markcorp](https://forum.freecodecamp.org/u/markcorp)\
**Post date:** [August 7, 2016, 10:06pm UTC](https://forum.freecodecamp.org/t/connect-to-an-sql-server-from-my-asp-net-page/26201/1 "2016-08-07T22:06:58Z")

</div>

Hi, I’m hoping someone can help me.

I have an [ASP.net](http://ASP.net) website posted to a domain I purchased on [domain.com](http://domain.com)  
[Domain.com](http://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](http://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

---

<div class="post-metadata">

**Author:** ![kblock-dev](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kblock-dev/32/13895_2.png) [@kblock-dev](https://forum.freecodecamp.org/u/kblock-dev)\
**Post date:** [August 9, 2016, 7:44pm UTC](https://forum.freecodecamp.org/t/connect-to-an-sql-server-from-my-asp-net-page/26201/2 "2016-08-09T19:44:58Z")

</div>

There are different types of SQL databases and it looks like you’re trying to use a MySQL database with your [ASP.NET](http://ASP.NET) website. If you Google something like “using MySQL with [ASP.NET](http://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.

---

<div class="post-metadata">

**Author:** ![zackmathew](https://avatars.discourse-cdn.com/v4/letter/z/5e9695/32.png) [@zackmathew](https://forum.freecodecamp.org/u/zackmathew)\
**Post date:** [October 6, 2016, 9:54am UTC](https://forum.freecodecamp.org/t/connect-to-an-sql-server-from-my-asp-net-page/26201/3 "2016-10-06T09:54:41Z")

</div>

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

[Add connection string of SQL server in asp.net page](https://www.mindstick.com/forum/799/where-to-add-connection-string-of-sql-server-in-asp-dot-net-page)

[Use and connect to MySQL Database in ASP.Net Application using MySQLConnector](http://www.aspsnippets.com/Articles/Use-and-connect-to-MySQL-Database-in-ASPNet-Application-using-MySQLConnector.aspx)

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 5:30am UTC](https://forum.freecodecamp.org/t/connect-to-an-sql-server-from-my-asp-net-page/26201/4 "2021-01-16T05:30:16Z")

</div>


