Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
GeneralRe: Count Char in String Pin
Alex Korchemniy16-Oct-04 20:58
Alex Korchemniy16-Oct-04 20:58 
GeneralPlease help User Control Pin
robmays16-Oct-04 16:45
robmays16-Oct-04 16:45 
GeneralRe: Please help User Control Pin
afinnell17-Oct-04 8:57
afinnell17-Oct-04 8:57 
GeneralRe: Please help User Control Pin
robmays17-Oct-04 20:47
robmays17-Oct-04 20:47 
GeneralMultiline text not displayed correctly in text box Pin
Luis Alonso Ramos16-Oct-04 12:38
Luis Alonso Ramos16-Oct-04 12:38 
GeneralRe: Multiline text not displayed correctly in text box Pin
Heath Stewart16-Oct-04 21:09
protectorHeath Stewart16-Oct-04 21:09 
GeneralRe: Multiline text not displayed correctly in text box Pin
Luis Alonso Ramos16-Oct-04 21:23
Luis Alonso Ramos16-Oct-04 21:23 
GeneralRe: Multiline text not displayed correctly in text box Pin
Heath Stewart16-Oct-04 21:31
protectorHeath Stewart16-Oct-04 21:31 
The first problem with your UPDATE statement is...

...NEVER use string concatentation to build SQL queries! Thing for a moment what happens when I set txtAddress.Text to the following (which gets assigned to person.Address, which gets passed to your query):
blah' AND 1=1; DROP TABLE YourTable; --
You get 0wned - that's with a zero. If you store credit card numbers, I could grab those. And don't think I can't - I can easily read your IL and string literals with tools that even come in the .NET Framework SDK (ildasm.exe). Major RDBMS's like SQL Server and Oracle support quering for schema information, so I can also find out what columns, tables, views, and databases you have (among other things).

Use parameterized queries. If this is for SQL Server, you'd use the SqlCommand.Parameters collection property, which is well-documented and includes examples. Be sure to read them, because different ADO.NET providers provide support parameters differently: both SQL Server and Oracle drivers support named parameters (but identified a little differently), while the OLE DB provider you must use question marks (?).

The problem could be in how your storing the data. All strings are encoded somehow, and your database encoding might be the problem - same as I mentioned for the text files (though databases typically abstract this problem away).

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: Multiline text not displayed correctly in text box Pin
Luis Alonso Ramos16-Oct-04 21:58
Luis Alonso Ramos16-Oct-04 21:58 
GeneralRe: Multiline text not displayed correctly in text box Pin
Heath Stewart16-Oct-04 22:13
protectorHeath Stewart16-Oct-04 22:13 
GeneralNo validation events when clicking on a toolbar Pin
Luis Alonso Ramos16-Oct-04 12:33
Luis Alonso Ramos16-Oct-04 12:33 
GeneralRe: No validation events when clicking on a toolbar Pin
Alex Korchemniy16-Oct-04 15:01
Alex Korchemniy16-Oct-04 15:01 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos16-Oct-04 15:49
Luis Alonso Ramos16-Oct-04 15:49 
GeneralRe: No validation events when clicking on a toolbar Pin
Heath Stewart16-Oct-04 20:58
protectorHeath Stewart16-Oct-04 20:58 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos16-Oct-04 22:07
Luis Alonso Ramos16-Oct-04 22:07 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos18-Oct-04 14:02
Luis Alonso Ramos18-Oct-04 14:02 
GeneralRe: No validation events when clicking on a toolbar Pin
Heath Stewart18-Oct-04 14:04
protectorHeath Stewart18-Oct-04 14:04 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos18-Oct-04 14:23
Luis Alonso Ramos18-Oct-04 14:23 
GeneralRe: No validation events when clicking on a toolbar Pin
Heath Stewart18-Oct-04 16:08
protectorHeath Stewart18-Oct-04 16:08 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos19-Oct-04 6:03
Luis Alonso Ramos19-Oct-04 6:03 
GeneralRe: No validation events when clicking on a toolbar Pin
Heath Stewart19-Oct-04 7:14
protectorHeath Stewart19-Oct-04 7:14 
GeneralRe: No validation events when clicking on a toolbar Pin
Luis Alonso Ramos19-Oct-04 7:39
Luis Alonso Ramos19-Oct-04 7:39 
GeneralGetting active MdiChild Pin
Luis Alonso Ramos16-Oct-04 12:29
Luis Alonso Ramos16-Oct-04 12:29 
GeneralRe: Getting active MdiChild Pin
Alex Korchemniy16-Oct-04 14:45
Alex Korchemniy16-Oct-04 14:45 
GeneralRe: Getting active MdiChild Pin
Luis Alonso Ramos16-Oct-04 15:17
Luis Alonso Ramos16-Oct-04 15:17 

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.