Click here to Skip to main content
15,908,834 members
Home / Discussions / C#
   

C#

 
QuestionHow to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
glitteringsound4-Sep-10 5:14
glitteringsound4-Sep-10 5:14 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
Not Active4-Sep-10 5:30
mentorNot Active4-Sep-10 5:30 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
dan!sh 4-Sep-10 5:33
professional dan!sh 4-Sep-10 5:33 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult4-Sep-10 5:59
mvePIEBALDconsult4-Sep-10 5:59 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
dan!sh 4-Sep-10 7:41
professional dan!sh 4-Sep-10 7:41 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult6-Sep-10 18:35
mvePIEBALDconsult6-Sep-10 18:35 
Questionhow to update listView on all clients machines when new data was added? Pin
kai-best4-Sep-10 5:06
kai-best4-Sep-10 5:06 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
Not Active4-Sep-10 5:41
mentorNot Active4-Sep-10 5:41 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:23
kai-best5-Sep-10 2:23 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
Not Active5-Sep-10 2:59
mentorNot Active5-Sep-10 2:59 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 4:12
mveOriginalGriff5-Sep-10 4:12 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
Not Active5-Sep-10 5:07
mentorNot Active5-Sep-10 5:07 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 5:15
mveOriginalGriff5-Sep-10 5:15 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff4-Sep-10 6:05
mveOriginalGriff4-Sep-10 6:05 
I agree with Mark - except I would use a application settings file for the connection string, rather than a constant. That way, you don't have to change the software when you do go to multi-user, just the app.settigns file. You can also test your software on an off-line database while the production one is untouched.

As for the SQL Injection - Mark is spot on. Look at the MySqlCommand.AddWithValue method for details. It makes life a lot simpler than string concatenation.

ListViewItem item = new ListViewItem("" + rdr[0]); // by the way why it doesn't work if i omit "" + ?
item.SubItems.Add("" + rdr[1]); // i have to add empty string for it to work...
item.SubItems.Add("" + rdr[2]);
It doesn't work because DateReader returns an object - you have to cast it to an appropriate data type. For example
ListViewItem item = new ListViewItem((string) rdr[0]);
item.SubItems.Add((int) rdr[1]);
item.SubItems.Add((float) rdr[2]);
By adding the empty string, you are forcing an implicit string conversion via the default ToString implementation. This may not be what you want in all cases...

When it comes to updates, and distributing them, I am afraid you will have to poll for them as Mark sugested. Use a timer, so you aren't looking all the time, and probably set a table with a last update column. Then you only have to read a single row in order to tell if you are up to date. Nasty, but better than reading an entire table.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

GeneralRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:29
kai-best5-Sep-10 2:29 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:44
kai-best5-Sep-10 2:44 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 4:10
mveOriginalGriff5-Sep-10 4:10 
GeneralRe: how to update listView on all clients machines when new data was added? [modified] Pin
kai-best6-Sep-10 3:22
kai-best6-Sep-10 3:22 
QuestionRule Engine Pin
Shubhabrata Mohanty4-Sep-10 3:45
Shubhabrata Mohanty4-Sep-10 3:45 
AnswerRe: Rule Engine Pin
dan!sh 4-Sep-10 4:40
professional dan!sh 4-Sep-10 4:40 
QuestionUpdating a progress bar in a loop Pin
Keith Vitali4-Sep-10 2:25
Keith Vitali4-Sep-10 2:25 
AnswerRe: Updating a progress bar in a loop Pin
Henry Minute4-Sep-10 3:25
Henry Minute4-Sep-10 3:25 
GeneralRe: Updating a progress bar in a loop Pin
Keith Vitali4-Sep-10 4:26
Keith Vitali4-Sep-10 4:26 
AnswerRe: Updating a progress bar in a loop Pin
PIEBALDconsult4-Sep-10 3:47
mvePIEBALDconsult4-Sep-10 3:47 
GeneralRe: Updating a progress bar in a loop Pin
Keith Vitali4-Sep-10 4:46
Keith Vitali4-Sep-10 4:46 

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.