Solved

SQL server 2008R2 - how is it connected to a .NET application?

Posted on 2012-04-03
7
263 Views
Last Modified: 2012-04-18
Hello:

I want to understand in simple English, how do .NET applications and how do websites get (fetch) information from SQL server.

So there is the SQL server on one side, the front end application ,or website, on the other end, BUT how do they connect? what is the process?

Thank you.
0
Comment
Question by:noamco36
7 Comments
 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 167 total points
ID: 37804698
most of the languages have inbuilt features to give user/Programmer functionality to connect to Databases.
so user just have to use these predefined functions and just pass the parameters  like username/Password/database server ip/type of database/Database name and others to make the connection.

ones the connection to the database is done we use sql command to query or write to the database.

Hope this helps...
0
 

Author Comment

by:noamco36
ID: 37804814
So does that mean that the initial connection set up is the responsibility on the application programmer?

If I am the DBA and am asked to connect an new application to my SQL server, and I dont know these inbuilt features/ Programmer functionalities, is there a work around with a third party application, or a driver setting etc?

Thanks.
0
 
LVL 6

Assisted Solution

by:Peter Kiprop
Peter Kiprop earned 83 total points
ID: 37804817
Hi noamco36,

if you are using VB.NET and ADO.NET then the code will be similar to the below

Public Function DBConnect() As SqlConnection
        Dim connectionstring As String
        connectionstring = "Persist Security Info=True;User ID=sa;Initial Catalog=DatabseName;Data Source=servername;password=Password"
        Dim cn As New SqlConnection(connectionstring)
        Return cn
End Function

    
Function GetAllContacts() As DataSet
        Dim cn As New SqlConnection
        Dim sql As String
        Dim ds As New DataSet
        Dim mytable As New DataTable("yourtablename")

        sql = "SELECT * FROM yourtablename"

    
        cn = DBConnect()
        cn.Open()
        Dim da As New SqlDataAdapter(sql, cn)
        da.Fill(ds, "yourtablename")
        'cn.Close() -- note: connection closed automatically by da.Fill

        Return ds
End Function

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 167 total points
ID: 37804844
So does that mean that the initial connection set up is the responsibility on the application programmer?

Yes it is the application programmer to make the connection with the application. he may require DBA for the required infromation.

If I am the DBA and am asked to connect an new application to my SQL server, and I dont know these inbuilt features/ Programmer functionalities, is there a work around with a third party application, or a driver setting etc?
normally as a DBA you will know about your server information which is required.
Database type - SQL, ORacle ,MYsql
ip address of the database server
port on which database is running
username and password for connecting to database
0
 
LVL 42

Assisted Solution

by:Eugene Z
Eugene Z earned 166 total points
ID: 37805321
app using sql server drivers
and as per above posted example connection string

check the differemt variations @

http://www.connectionstrings.com/sql-server-2008
0
 
LVL 42

Assisted Solution

by:Eugene Z
Eugene Z earned 166 total points
ID: 37805324
check this presentation as well
Linking ASP.NET Page to SQL Server 2008R2 - Overview Visual Web Developer Express
http://www.youtube.com/watch?v=SyEV6oJI6Bw
0
 
LVL 25

Accepted Solution

by:
jogos earned 84 total points
ID: 37805472
Adding to theabove

The dba/security-responsible defines how connections may be made
- which logins and their permissions
- eventualy a specific application role http://msdn.microsoft.com/en-us/library/ms190998.aspx

The developer decides how deal whit that permission
- .Net Entity Framework http://msdn.microsoft.com/en-us/library/aa697427(v=vs.80).aspx
- other ORM-solutions
     http://en.wikipedia.org/wiki/Object-relational_mapping
     http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SCOM to SQL port 14xx failed? 1 32
SQL Server Resume 5 46
add stored proc on publlication 4 20
SQL Server Serialization error 8 15
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question