Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2012-04-03
7
262 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQl Query to find x consecutive Nbrs in a Table 30 97
query question 12 32
Connect to an SQL server ActiveX 10 23
MS SQL Delete Duplicate Rows Only 2 15
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

809 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