Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-04-03
7
Medium Priority
?
266 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
[X]
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
7 Comments
 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 668 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 332 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 668 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 43

Assisted Solution

by:Eugene Z
Eugene Z earned 664 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 43

Assisted Solution

by:Eugene Z
Eugene Z earned 664 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 336 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

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.

Question has a verified solution.

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

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.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

618 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