Solved

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

Posted on 2012-04-03
7
256 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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:EugeneZ
EugeneZ 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:EugeneZ
EugeneZ 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

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

932 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now