Click here to Skip to main content
15,890,845 members
Home / Discussions / C#
   

C#

 
AnswerRe: System.Net.Mail setup Pin
Yusuf4-Mar-09 9:23
Yusuf4-Mar-09 9:23 
GeneralRe: System.Net.Mail setup Pin
dptalt4-Mar-09 10:01
dptalt4-Mar-09 10:01 
GeneralRe: System.Net.Mail setup Pin
Yusuf4-Mar-09 10:14
Yusuf4-Mar-09 10:14 
AnswerRe: System.Net.Mail setup Pin
Dave Kreskowiak4-Mar-09 9:51
mveDave Kreskowiak4-Mar-09 9:51 
QuestionPopulating combobox with values from Table using C# Pin
haroon19804-Mar-09 8:05
haroon19804-Mar-09 8:05 
AnswerRe: Populating combobox with values from Table using C# [modified] Pin
Jimmanuel4-Mar-09 8:41
Jimmanuel4-Mar-09 8:41 
GeneralRe: Populating combobox with values from Table using C# Pin
haroon19804-Mar-09 9:18
haroon19804-Mar-09 9:18 
GeneralRe: Populating combobox with values from Table using C# Pin
Jimmanuel4-Mar-09 9:44
Jimmanuel4-Mar-09 9:44 
How often is the DB Table going to change? If it doesn't change or rarely changes then you really only need to populate the combo box values once - when the form loads. If it does change frequently then there are lots of good ways to keep the combo box up to date. You could use a timer to reload the values every so often, put a button on the form that allows the user to refresh whenever they want or work out some way of receiving a notification any time that the table changes.

database.Close() is just as important. That closes the connection to the DB, otherwise it gets orphaned. A using[^] statement would be helpful in making sure that everything gets cleaned up whether an exception is thrown or not.

Say your table has 10 rows; that means that all you want from it is 10 product names but a select * statement is giving you back the 10 product names plus 20 other values that you aren't using. That's 3 times as much network traffic as you actually need. It might not be a big deal now but what if there were 10,000 rows? What if later on the table changes and more columns get added? For each column that's added that's more unnecessary traffic between your app and your DB and more time and memory required to handle your select. Select distinct ProductName is the way to go here. In fact, I can't recall a time that I've ever used select *.



AnswerRe: Populating combobox with values from Table using C# Pin
Yusuf4-Mar-09 9:26
Yusuf4-Mar-09 9:26 
GeneralRe: Populating combobox with values from Table using C# Pin
haroon19804-Mar-09 10:54
haroon19804-Mar-09 10:54 
QuestionC# Referencing Cell on DataGrid Pin
Wheels0124-Mar-09 6:06
Wheels0124-Mar-09 6:06 
AnswerRe: C# Referencing Cell on DataGrid Pin
dan!sh 4-Mar-09 6:08
professional dan!sh 4-Mar-09 6:08 
GeneralRe: C# Referencing Cell on DataGrid Pin
Wheels0124-Mar-09 6:40
Wheels0124-Mar-09 6:40 
GeneralRe: C# Referencing Cell on DataGrid Pin
led mike4-Mar-09 7:13
led mike4-Mar-09 7:13 
GeneralRe: C# Referencing Cell on DataGrid Pin
Wheels0124-Mar-09 7:19
Wheels0124-Mar-09 7:19 
GeneralRe: C# Referencing Cell on DataGrid Pin
Samuel Cherinet4-Mar-09 19:54
Samuel Cherinet4-Mar-09 19:54 
GeneralRe: C# Referencing Cell on DataGrid Pin
Wheels0125-Mar-09 1:22
Wheels0125-Mar-09 1:22 
Questionicons in buttons with flatstyle.System Pin
mirko864-Mar-09 5:43
mirko864-Mar-09 5:43 
AnswerRe: icons in buttons with flatstyle.System Pin
Xmen Real 4-Mar-09 6:05
professional Xmen Real 4-Mar-09 6:05 
QuestionComboBox in DataGridview Pin
rafaelht31084-Mar-09 4:31
rafaelht31084-Mar-09 4:31 
AnswerRe: ComboBox in DataGridview Pin
Xmen Real 4-Mar-09 4:54
professional Xmen Real 4-Mar-09 4:54 
GeneralRe: ComboBox in DataGridview Pin
rafaelht31084-Mar-09 5:07
rafaelht31084-Mar-09 5:07 
Questionwater marking Pin
rohan40404-Mar-09 4:25
rohan40404-Mar-09 4:25 
AnswerRe: water marking Pin
Xmen Real 4-Mar-09 4:35
professional Xmen Real 4-Mar-09 4:35 
Questionwater marking Pin
rohan40404-Mar-09 4:23
rohan40404-Mar-09 4:23 

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.