Click here to Skip to main content
15,917,320 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL Server Reporting Reset Page count or use distinctcount() for page number Pin
bubberz22-Sep-05 7:58
bubberz22-Sep-05 7:58 
AnswerRe: SQL Server Reporting Reset Page count or use distinctcount() for page number Pin
bubberz22-Sep-05 11:02
bubberz22-Sep-05 11:02 
QuestionMs-Access Vs Sql-Server 2000 Pin
Naveed Kamboh22-Sep-05 4:37
Naveed Kamboh22-Sep-05 4:37 
AnswerRe: Ms-Access Vs Sql-Server 2000 Pin
miah alom22-Sep-05 5:14
miah alom22-Sep-05 5:14 
AnswerRe: Ms-Access Vs Sql-Server 2000 Pin
Luis Alonso Ramos22-Sep-05 7:16
Luis Alonso Ramos22-Sep-05 7:16 
GeneralRe: Ms-Access Vs Sql-Server 2000 Pin
Naveed Kamboh23-Sep-05 3:01
Naveed Kamboh23-Sep-05 3:01 
QuestionSelect Pin
NormBohana21-Sep-05 15:09
NormBohana21-Sep-05 15:09 
AnswerRe: Select Pin
Christian Graus21-Sep-05 15:38
protectorChristian Graus21-Sep-05 15:38 
AnswerRe: Select Pin
miah alom22-Sep-05 3:26
miah alom22-Sep-05 3:26 
QuestionStored Query in Access Pin
kornstyle21-Sep-05 8:53
kornstyle21-Sep-05 8:53 
AnswerRe: Stored Query in Access Pin
Christian Graus21-Sep-05 15:40
protectorChristian Graus21-Sep-05 15:40 
QuestionUpdate Pin
Illegal Operation21-Sep-05 2:29
Illegal Operation21-Sep-05 2:29 
AnswerRe: Update Pin
Christian Graus21-Sep-05 15:39
protectorChristian Graus21-Sep-05 15:39 
QuestionExpression column in a Datatable not evaluating Pin
convergence21-Sep-05 0:22
convergence21-Sep-05 0:22 
AnswerRe: Expression column in a Datatable not evaluating Pin
sreejith ss nair21-Sep-05 0:49
sreejith ss nair21-Sep-05 0:49 
GeneralRe: Expression column in a Datatable not evaluating Pin
convergence21-Sep-05 2:36
convergence21-Sep-05 2:36 
GeneralThe Solution Pin
convergence21-Sep-05 17:08
convergence21-Sep-05 17:08 
Questiondataset size limits... Pin
l a u r e n20-Sep-05 18:54
l a u r e n20-Sep-05 18:54 
AnswerRe: dataset size limits... Pin
Andy Brummer20-Sep-05 19:46
sitebuilderAndy Brummer20-Sep-05 19:46 
Questionxml schemas... Pin
l a u r e n20-Sep-05 17:11
l a u r e n20-Sep-05 17:11 
AnswerRe: xml schemas... Pin
Andy Brummer20-Sep-05 19:54
sitebuilderAndy Brummer20-Sep-05 19:54 
QuestionBest practices for user defined fields Pin
econner20-Sep-05 16:42
econner20-Sep-05 16:42 
AnswerRe: Best practices for user defined fields Pin
Edbert P20-Sep-05 18:27
Edbert P20-Sep-05 18:27 
AnswerRe: Best practices for user defined fields Pin
Andy Brummer20-Sep-05 20:01
sitebuilderAndy Brummer20-Sep-05 20:01 
QuestionDatabound ComboBox Selection Problems Pin
Glenn E. Lanier II20-Sep-05 15:33
Glenn E. Lanier II20-Sep-05 15:33 
I am displaying a ComboBox that hopefully contains the contents of a database table (a lookup of sorts). When the form loads, the ComboBox contains the correct values, all sorted. Smile | :)

However, when I try to select a value programitically, I can't (well, I can't select the correct one). Frown | :(

I create a dataset:
DataSet dsTitles = new DataSet("Titles");<br />
SqlCommand tableCommand = new SqlCommand();<br />
tableCommand.CommandText = "select TitleID, TitleDisplayText FROM tblTitles WHERE TitleHidden <> 1";<br />
<br />
SqlDataAdapter adapter = new SqlDataAdapter();<br />
adapter.SelectCommand = tableCommand;<br />
adapter.Fill(dsTitles, "Titles"); 


I then bind the dataset to the ComboBox:
comboBoxTitle.BeginUpdate();<br />
comboBoxTitle.DataSource = db.DataSetTitles.Tables["Titles"];<br />
comboBoxTitle.DisplayMember = "TitleDisplayText";<br />
comboBoxTitle.ValueMember = "TitleID";<br />
comboBoxTitle.EndUpdate();


So far, all is well. However, I can't seem to select the correct item. I've tried:
comboBoxTitle.SelectedValue = 2;<br />
Console.WriteLine("Current Title Index: {0} Text: {1} Combo Index: {2} Value: {3} Text: {4}", 2, db.LookupValueTitle(2), comboBoxTitle.SelectedIndex, comboBoxTitle.SelectedValue);<br />


TitleID of 2 matches TitleDisplayText of Mr, but nothing is visibily selected.

Current Title Index: 2 Text: Mr Combo Index: 0 Value: 2 Text: 
is what gets logged.

Any help would be appreciated.

--G Confused | :confused:

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.