But you can skip the if check if you are simply going to iterate
without any intermediary logic. "while (OdbcDR.Read())" alone would
have the same effect in this code -- as it is written now.

∞ Andy Badera
∞ This email is: [ ] bloggable [x] ask first [ ] private
∞ Google me: http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)



On Mon, Aug 31, 2009 at 4:28 PM, AstroDrabb<[email protected]> wrote:
> You should check your DataReader to see if it "HasRows".  The HasRows
> property returns true or false.  If you don't have rows, you won't get any
> items in your combo.
>
> if (OdbcDR.HasRows)
> {
>   while (OdbcDr.Read())
>   {
>     ..
>   }
> }
> else
> {
>   // hey no data!
> }
>
> On Mon, Aug 31, 2009 at 3:54 PM, VIKAS GARG <[email protected]>
> wrote:
>>
>> while (OdbcDr.Read())
>>                    {
>>
>>                        // Getting the data off DataReader in a string...
>>                        string DRData = (string)OdbcDr[0];//Here
>> OdbcDr is DataReader's object
>>
>>                        //Adding the data to the combobox
>>                        Combo.Items.Add(DRData);
>>                    }
>>
>> On 9/1/09, AstroDrabb <[email protected]> wrote:
>> > Oh, P.S. you need VS Pro or greater to do this.
>> >
>> > On Mon, Aug 31, 2009 at 2:55 PM, AstroDrabb <[email protected]>
>> > wrote:
>> >
>> >> You can debug the stored procedures and SQL.  At least in SQL Server
>> >> since
>> >> 2000.  However SQL Server 2005 moved it out to Visual Studio.
>> >>
>> >>
>> >> As for the original Q, show the code you are using to populate the drop
>> >> down.
>> >>
>> >> On Mon, Aug 31, 2009 at 2:00 PM, Cerebrus <[email protected]> wrote:
>> >>
>> >>> (I don't know how anyone can debug a database)
>
>

Reply via email to