473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Stored procedure or view?

I am creating a web app for a client in VS.NET using ASP.NET with C#. I need
to query three tables in a database using one parameter and display the
results on the page. my question is should I use a Stored Procedure or view
in SQL Server to get the data from multiple tables? What is the difference?
and where can I find a some articles on write code to display the results of
the SP or view?

Thanks, Justin.
Nov 18 '05 #1
2 1819
Justin,
You can use either one, or you can use combination of both; create a view
and access it from a stored procedure. The best practice is to use Stored
Procedures for any data-related operation especailly in a web application.

Here's the definitions from SQL Server Book Online:

Stored Procedure:
A stored procedure is a group of Transact-SQL statements compiled into a
single execution plan.

View:
A view can be thought of as either a virtual table or a stored query. The
data accessible through a view is not stored in the database as a distinct
object. What is stored in the database is a SELECT statement. The result set
of the SELECT statement forms the virtual table returned by the view. A user
can use this virtual table by referencing the view name in Transact-SQL
statements the same way a table is referenced.

See books online for more information.
"Justin" wrote:
I am creating a web app for a client in VS.NET using ASP.NET with C#. I need
to query three tables in a database using one parameter and display the
results on the page. my question is should I use a Stored Procedure or view
in SQL Server to get the data from multiple tables? What is the difference?
and where can I find a some articles on write code to display the results of
the SP or view?

Thanks, Justin.

Nov 18 '05 #2
From what you've said, I would go with a stored procedure (try a search for
<italics>microsoft data access block</italics>). To actually display the
results - www.asp.net has some pointers.

"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I am creating a web app for a client in VS.NET using ASP.NET with C#. I
need
to query three tables in a database using one parameter and display the
results on the page. my question is should I use a Stored Procedure or
view
in SQL Server to get the data from multiple tables? What is the
difference?
and where can I find a some articles on write code to display the results
of
the SP or view?

Thanks, Justin.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: aaj | last post by:
SQL SERVER 2000 Hi all This is my first attempt at writing a stored procedure. I have managed to get it working but its unlikely to be the best way of handling the problem. While writing it I...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
4
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure...
1
by: Brad H McCollum | last post by:
I've looked through many suggestions and partial examples all over this newsgroup and still am not coming up with anything that does specifically what I'm wanting to accomplish. I'm writing a VB...
1
by: Lyle Fairfield | last post by:
I created a new MS-SQL Database, "TestODBC". I made Table1 and StoredProcedure1. I made an ODBC DSN for that MS-SQL Database. I created a new AccessXP mdb, "TestODBC". I linked to the...
0
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone....
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
1
by: Sureshbari | last post by:
Dear All, I have four table in database , each table contain the 5 lacs record, i have created a view on that four table using union clause. and now i am call that view form my code like ...
1
by: apothecary | last post by:
Hello Newbie here. Is there a way of creating a VIEW...using a stored procedure. I am basically trying to create a view to return some data that I am getting using a stored procedure. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.