Click here to Skip to main content
15,885,244 members
Home / Discussions / C#
   

C#

 
GeneralRe: connectionstring to sqlexpress 2005 Pin
Henry Minute19-Jan-11 7:48
Henry Minute19-Jan-11 7:48 
GeneralRe: connectionstring to sqlexpress 2005 Pin
Dan Mos19-Jan-11 7:55
Dan Mos19-Jan-11 7:55 
GeneralRe: connectionstring to sqlexpress 2005 Pin
arkiboys19-Jan-11 11:23
arkiboys19-Jan-11 11:23 
AnswerRe: connectionstring to sqlexpress 2005 Pin
jschell19-Jan-11 8:40
jschell19-Jan-11 8:40 
QuestionDataBindingComplete on ComboBox? Pin
Dewald19-Jan-11 0:36
Dewald19-Jan-11 0:36 
AnswerRe: DataBindingComplete on ComboBox? Pin
Dan Mos19-Jan-11 1:04
Dan Mos19-Jan-11 1:04 
GeneralRe: DataBindingComplete on ComboBox? Pin
Dewald19-Jan-11 3:34
Dewald19-Jan-11 3:34 
AnswerRe: DataBindingComplete on ComboBox? [modified] Pin
RaviRanjanKr19-Jan-11 1:30
professionalRaviRanjanKr19-Jan-11 1:30 
Dewald wrote:
please let me know so I can start doing it differently

I used any one way based on condition to bind database with Combobox. The two different way are given below
// Connected Environment
  SqlCommand cmd = new SqlCommand("Query",connetion);
  SqlDataReader dr = cmd.ExecuteReader();
  while (dr.Read())
          {
           comboBox1.Items.Add(dr[index].ToString());
          }

and
// Disconnected Environment
 SqlCommand cmd = new SqlCommand("Query",connetion);
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    da.Fill(ds,tablename);
    DataTable dt = ds.Tables[tablename];
    DataRow dr;
    int x = 0;
    while (x != dt.Rows.Count)
       {
         dr = dt.Rows[x];
         comboBox1.Items.Add(dr[index].ToString());//index may be 0,1 etc based on your condition
              x++;
       }


let us know in case of any query Smile | :)

modified on Wednesday, January 19, 2011 8:14 AM

AnswerRe: DataBindingComplete on ComboBox? Pin
ToddHileHoffer19-Jan-11 2:44
ToddHileHoffer19-Jan-11 2:44 
GeneralRe: DataBindingComplete on ComboBox? Pin
Dewald19-Jan-11 3:47
Dewald19-Jan-11 3:47 
GeneralRe: DataBindingComplete on ComboBox? Pin
ToddHileHoffer19-Jan-11 4:38
ToddHileHoffer19-Jan-11 4:38 
AnswerRe: DataBindingComplete on ComboBox? Pin
_Erik_19-Jan-11 3:28
_Erik_19-Jan-11 3:28 
GeneralRe: DataBindingComplete on ComboBox? Pin
Dewald19-Jan-11 4:00
Dewald19-Jan-11 4:00 
GeneralRe: DataBindingComplete on ComboBox? Pin
_Erik_19-Jan-11 5:58
_Erik_19-Jan-11 5:58 
AnswerRe: DataBindingComplete on ComboBox? Pin
MumbleB19-Jan-11 6:24
MumbleB19-Jan-11 6:24 
GeneralRe: DataBindingComplete on ComboBox? Pin
Dewald19-Jan-11 20:40
Dewald19-Jan-11 20:40 
Questionhow should i word this... and better...how should i do it? Pin
jwalker34318-Jan-11 17:01
jwalker34318-Jan-11 17:01 
AnswerRe: how should i word this... and better...how should i do it? Pin
PIEBALDconsult18-Jan-11 18:19
mvePIEBALDconsult18-Jan-11 18:19 
GeneralRe: how should i word this... and better...how should i do it? Pin
jwalker34319-Jan-11 1:59
jwalker34319-Jan-11 1:59 
AnswerRe: how should i word this... and better...how should i do it? Pin
#realJSOP18-Jan-11 23:47
mve#realJSOP18-Jan-11 23:47 
GeneralRe: how should i word this... and better...how should i do it? Pin
jwalker34319-Jan-11 2:05
jwalker34319-Jan-11 2:05 
GeneralRe: how should i word this... and better...how should i do it? Pin
#realJSOP19-Jan-11 2:10
mve#realJSOP19-Jan-11 2:10 
GeneralRe: how should i word this... and better...how should i do it? Pin
DaveyM6919-Jan-11 2:48
professionalDaveyM6919-Jan-11 2:48 
GeneralRe: how should i word this... and better...how should i do it? Pin
#realJSOP19-Jan-11 2:52
mve#realJSOP19-Jan-11 2:52 
GeneralRe: how should i word this... and better...how should i do it? Pin
jwalker34319-Jan-11 16:37
jwalker34319-Jan-11 16:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.