newbie ~ View or Stored Procedure

D

Douglas Buchanan

sql server / ado.net / vb.net

What is the better approach to populating a subset of table data to a
datagrid or form of controls - a view or a stored procedure?
 
W

William \(Bill\) Vaughn

A view is simply a shortcut way to refer to relational objects. A stored
procedure is a program used to return one or more resultsets containing a
rowset, output parameters and a RETURN value based on SQL statements and
TSQL logic. It's like asking which is better, a nail or a screw. They are
both useful when applied correctly.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
S

Sahil Malik

Your question could be read in four ways --

"populating a subset of table data to a datagrid or form of controls - a
dataview or a stored procedure?"
or
"populating a subset of datatable data to a datagrid or form of controls - a
view or a stored procedure?"
or
"populating a subset of datatable data to a datagrid or form of controls - a
dataview or a stored procedure?"
or
"populating a subset of table data to a datagrid or form of controls - a
view or a stored procedure?"

The
answer to #1 is -- stored proc, because, no use introducing an extra object
(dataview), when a dataset can be bound directly.
answer to #2 is -- stored proc, because even though view's query plan is
cached, stored procedures offer other advantages like table structure
abstraction and security.
answer to #3 is -- dataview, because it would avoid an extra roundtrip/hit
to the database.
answer to #4 is -- stored proc, because of same reasons as #2.

Thought I might mention that my answers are like on size fits all, and the
golden rule with database related anything is, there is no "/makeworkbetter"
switch. It's a black art that needs knowledge and experience.

- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top