First time through on this, so I could use some help.

I'm having difficulty getting data from a stored procedure into a
DataGridView control in a Windows form. I'm using VS2005 and C#.

My test program has two DataGridView controls. One is populated via SQL
generated via drag/drop/property settings, and works like a charm. I'm
trying to do the same thing with the other, but using a stored procedure as
the source of the data. I know the stored procedure works, and it returns
the same data as the SQL in the first control. Nothing appears in the
control at runtime.

At design time, there are no columns automatically added to the control.
So, I tried to add them via the Columns collection. No column names
appeared in the DataPropertyName dropdown on the property sheet for my new
columns. I entered the field name for each of the new columns, but still no
luck.

Could someone provide a 'how to' on this, or maybe point me to where the
explanation is in the documentation?

Thanks in advance,
Ben

--
bf001removethis@abovetheline.biz

Re: VS2005 / Stored Procedure by Dries

Dries
Tue Nov 29 14:15:37 CST 2005

How did you generate you data classes? With the help of a wizard? Or
just manually typed the code (which is not as difficult as you might think)?

grtz,
Dries

BJF wrote:
> First time through on this, so I could use some help.
>
> I'm having difficulty getting data from a stored procedure into a
> DataGridView control in a Windows form. I'm using VS2005 and C#.
>
> My test program has two DataGridView controls. One is populated via SQL
> generated via drag/drop/property settings, and works like a charm. I'm
> trying to do the same thing with the other, but using a stored procedure as
> the source of the data. I know the stored procedure works, and it returns
> the same data as the SQL in the first control. Nothing appears in the
> control at runtime.
>
> At design time, there are no columns automatically added to the control.
> So, I tried to add them via the Columns collection. No column names
> appeared in the DataPropertyName dropdown on the property sheet for my new
> columns. I entered the field name for each of the new columns, but still no
> luck.
>
> Could someone provide a 'how to' on this, or maybe point me to where the
> explanation is in the documentation?
>
> Thanks in advance,
> Ben
>