Aliased column in stored procedure not seen by datagrid

N

.Net Sports

i have an aliased column in an sql statement that works fine when
displaying its output in a datagrid, but when I transfer the sql
statement into a stored procedure , the datagrid can't see it. I get an
error "{"DataBinder.Eval: 'System.Data.DataRowView' does not contain a
property with the name myaliasedcolumn." }
 
V

Verde

Simply moving a SELECT statement into a stored procedure will not result in
your observation.

You need to verify that the stored procedure is returning what you think it
is returning. You should be able to run both the stored procedure and the
SELECT statement in Query Analyzer and verify that they return the same
things (they should). One thing to look for is if the stored procedure
returns more than one result set. It will return one result set for each
SELECT statement it contains that gets executed. If this is the case, then
you may be trying to bind the datagrid to the wrong result set - and that's
why it's choking.

And in you application, be sure that your .CommandType is StoredProcedure -
like this:
cmd.CommandType = CommandType.StoredProcedure;

-HTH
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top