VisualBuilder
  Home > Aspnet > Tutorials > Accessing SQL SERVER Database [Using SqlDataSource] - ASP.NET Database Tutorial
Tell a friend
Link to us
Total Members
      Members: 84657
     
Sitemap Forum Chat
Home
ASP.NET Database Tutorial Home
1 . Introduction to Asp.Net 2.0
2 . Introduction to ADO.Net
3 . Connecting Access Database with AccessDataSource and GridView Control
4 . Accessing SQL SERVER Database [Using SqlDataSource]
5 . Storing Connection String in Web.Config File
6 . Inserting Records in Database
7 . Updating Records in Database
8 . Updating Records in Database
9 . Deleting Records from Database
10 . Execute Scalar: Getting Single Value from the Database
11 . Execute Reader: Fetching Records from Database
12 . Data Adapter
13 . Data Adapter and Database Connection
14 . Performing Batch Updates: Using SqlCommandBuilder
15 . Improving Performance using Stored Procedure
16 . Filtering and Sorting Data Using DataView/DataTable
17 . Data Binding and Data Synchronization
18 . SQL Transaction and Locking
19 . SQL Joins and .Net
20 . Automatically Generation of SQL Statement
 
Aspnet Group Home
Aspnet Discussion (10)
Aspnet Members (2382)
Aspnet Resources
Aspnet Source Code (388)
Aspnet Articles (1)
Aspnet Blogs
Aspnet Jobs
Aspnet Components (201)
Aspnet Books
Aspnet Websites (21)
Aspnet News (105)
Aspnet Q & A (114)
- Aspnet Ask Question
- Aspnet Questions
- Aspnet Unanswered Questions
 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.NET Development Tips
ASP.Net Security,Internationalisation And Deployment
ASP.NET Server Controls Tips
ASP.NET Tutorial
C Sharp Tutorial
LINQ
Web Development
Flex Tutorial
HTML Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Grails Tutorial
Hibernate Tutorial
Java 1.6 Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Service-Oriented Architecture (SOA) Tutorial For Managers
Spring Tutorial
Struts Tutorial

RESOURCES
Q & A (434 )
Source Code (3275 )
Articles (11 )
Components (1595 )
News (888 )
Websites (1207 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Link To Us
Feedback
Tell a Friend
Partners
Advertise

Aspnet database Tutorial
 Accessing SQL SERVER Database [Using SqlDataSource]
  << Prev: Connecting Access Database with AccessDataSource and GridView Control Next: Storing Connection String in Web.Config File >>

The full version of SQL Server includes three main parts or groups of functions. Note that there are no built-in tools for creating a user interface (front end) to the database. That is left to tools such as Windows Forms or ASP.NET for Web pages. The three main parts of SQL Server include:



  • The SQL Server engine, which actually organizes the data and reads or writes in response to commands in code. This also includes tools such as the Query Analyzer and Data Transformation Services.

  • SQL Management Studio (or Enterprise Manager in older versions), which provides a central point for all database management functions, including the creation of new databases.

  • Tools for administering a database, ranging from backup utilities to replication schemes.


Example: Demonstrate accessing SQL SERVER database.


 


 


<% @ Page Language ="C#" AutoEventWireup ="true" CodeFile ="SqlDataSource.aspx.cs" Inherits ="SqlDataSource" %>


 


<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


 


<html xmlns ="http://www.w3.org/1999/xhtml" >


<head runat ="server">


</head >


<body >


<form id ="form1" runat ="server">


<div >


<asp:SqlDataSource ID ="SqlDataSource1" runat ="server" ConnectionString =" <% $ ConnectionStrings:pubsConnectionString %> " SelectCommand ="SELECT [emp_id], [fname], [lname], [minit], [job_id], [job_lvl], [pub_id], [hire_date] FROM [employee] ORDER BY [fname]">


</asp:SqlDataSource>


</div >


<asp:GridView ID ="GridView1" runat ="server" AllowPaging ="True" AllowSorting ="True" AutoGenerateColumns ="False" DataKeyNames ="emp_id"


DataSourceID ="SqlDataSource1">


<Columns >


<asp:BoundField DataField ="emp_id" HeaderText ="emp_id" ReadOnly ="True" SortExpression ="emp_id" />


<asp:BoundField DataField ="fname" HeaderText ="fname" SortExpression ="fname" />


<asp:BoundField DataField ="lname" HeaderText ="lname" SortExpression ="lname" />


<asp:BoundField DataField ="minit" HeaderText ="minit" SortExpression ="minit" />


<asp:BoundField DataField ="job_id" HeaderText ="job_id" SortExpression ="job_id"/>


<asp:BoundField DataField ="job_lvl" HeaderText ="job_lvl" SortExpression="job_lvl"/>


<asp:BoundField DataField ="pub_id" HeaderText ="pub_id" SortExpression ="pub_id"/>


<asp:BoundField DataField ="hire_date" HeaderText ="hire_date" SortExpression ="hire_date" />


</Columns >


</asp:GridView>


</form >


</body >


</html >


 


  << Prev: Connecting Access Database with AccessDataSource and GridView Control Next: Storing Connection String in Web.Config File >>
Aspnet Database Tutorial Home
Give feedback and win a prize.

 
   Printer Friendly
   Email to a friend
   Add to my Favourites    
  Download PDF version
   Report Bad Submissions
   Submit Feedback
 
  Delicious   Digg   Technorati   Blink   Furl   Reddit   Newsvine   Google Click each image to add
this page to each site.
 
 
Welcome Guest Signup
MEMBER'S PANEL
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!
 
SEARCH
 
 
LINKS
faxing online
Skype vs. sipcall
Gift to Pakistan
 
ADVERTISEMENT
 
PARTNER LIST

More
 
 
 

Home | Login | About Us | Contact Us | Privacy Policy | Advertising