It would if you didn't care if the combo got populated.  That is whey the
else { } block is there.  The origianl Q? was that the drop down didn't get
filled.

So something in his query is not pulling back data.  Normally when I run a
code to pull back data, I expect data so I check for it.  If there is a
possibility that I don't always get data, I still want to check for it so
the code can flow depending on data or no data.

On Mon, Aug 31, 2009 at 4:33 PM, Andrew Badera <[email protected]> wrote:

>
> 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)<http://www.google.com/search?q=%28andrew+badera%29+OR+%28andy+badera%29>
>
>
> 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