PC Review


Reply
Thread Tools Rate Thread

DataGrid and SQL Server view

 
 
Matt
Guest
Posts: n/a
 
      13th Jul 2003
Hi,

I'm trying to fill an ASP.NET DataGrid from a SQL-Server View. Note
that this is a View and not a Stored Procedure.

If i write the SQL instructions directly in the code, or if i use a
stored procedure, it works great. But if the same SQL instructions are
in a view, it won't work. Here it goes :


public IDataReader SomeFunction()
{
SqlCommand ObjCmd = new SqlCommand();

ObjCmd.Connection = m_ObjCon;
ObjCmd.CommandText = "[Sales by Category]";
ObjCmd.CommandType = CommandType.StoredProcedure;

return ObjCmd.ExecuteReader();
}


It gives me an error, "The request for procedure 'Sales by Category'
failed because 'Sales by Category' is a view object."

My question is, is it possible to use a view instead of a stored
procedure in this context? I'm a little confused about the difference
between both. Thanks for help!

Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid view (or datagrid) to text file =?Utf-8?B?cm9nZXJfMjc=?= Microsoft C# .NET 2 23rd Mar 2007 06:52 PM
View in SQL Server float, same view linked in Access Long Integer =?Utf-8?B?SG9sbHk=?= Microsoft Access External Data 0 7th Jun 2006 04:20 PM
Using Visual Studio & datagrid to select from sql server view gfarrell@hotmail.com Microsoft ADO .NET 0 27th Apr 2006 07:36 AM
datagrid scrolling...capturihng rows displayed in view of datagrid Patrick Microsoft Dot NET Framework Forms 3 7th Jun 2004 11:07 AM
DataGrid and SQL Server view Matt Microsoft ASP .NET 1 13th Jul 2003 07:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 PM.