Click here to Skip to main content
15,884,099 members
Home / Discussions / C#
   

C#

 
QuestionHow to parse certain values from an invisible cmdline Pin
wesley994626-Aug-18 5:08
wesley994626-Aug-18 5:08 
AnswerRe: How to parse certain values from an invisible cmdline Pin
Mycroft Holmes26-Aug-18 13:14
professionalMycroft Holmes26-Aug-18 13:14 
GeneralRe: How to parse certain values from an invisible cmdline Pin
wesley994626-Aug-18 13:37
wesley994626-Aug-18 13:37 
AnswerRe: How to parse certain values from an invisible cmdline Pin
OriginalGriff26-Aug-18 21:25
mveOriginalGriff26-Aug-18 21:25 
AnswerRe: How to parse certain values from an invisible cmdline Pin
Matias Lopez31-Aug-18 8:54
Matias Lopez31-Aug-18 8:54 
QuestionC# float variable are losing their decimals after being inserted on MySQL database Pin
Member 1394865826-Aug-18 2:18
Member 1394865826-Aug-18 2:18 
QuestionRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
Richard MacCutchan26-Aug-18 2:56
mveRichard MacCutchan26-Aug-18 2:56 
AnswerRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
OriginalGriff26-Aug-18 4:04
mveOriginalGriff26-Aug-18 4:04 
To add to what Richard has said, don't do it like that!
Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.

When you concatenate strings, you cause problems because SQL receives commands like:
SQL
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood'
The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SQL
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable;--'
Which SQL sees as three separate commands:
SQL
SELECT * FROM MyTable WHERE StreetAddress = 'x';
A perfectly valid SELECT
SQL
DROP TABLE MyTable;
A perfectly valid "delete the table" command
SQL
--'
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.

So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

AnswerRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
Richard Andrew x6426-Aug-18 4:16
professionalRichard Andrew x6426-Aug-18 4:16 
AnswerRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
MadMyche27-Aug-18 9:38
professionalMadMyche27-Aug-18 9:38 
GeneralRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
Richard Andrew x642-Sep-18 5:20
professionalRichard Andrew x642-Sep-18 5:20 
QuestionHow to get all excel cell data and update new data under specific cell using c# Pin
Sammed24-Aug-18 2:36
Sammed24-Aug-18 2:36 
QuestionC# List<Task> Execution Order Pin
Kevin Marois23-Aug-18 8:22
professionalKevin Marois23-Aug-18 8:22 
AnswerRe: C# List<Task> Execution Order Pin
Richard Deeming23-Aug-18 8:37
mveRichard Deeming23-Aug-18 8:37 
GeneralRe: C# List<Task> Execution Order Pin
Kevin Marois23-Aug-18 9:00
professionalKevin Marois23-Aug-18 9:00 
GeneralRe: C# List<Task> Execution Order Pin
Bernhard Hiller23-Aug-18 21:40
Bernhard Hiller23-Aug-18 21:40 
QuestionUnzip file from resources Pin
JCompier21-Aug-18 19:15
JCompier21-Aug-18 19:15 
AnswerRe: Unzip file from resources Pin
OriginalGriff21-Aug-18 19:34
mveOriginalGriff21-Aug-18 19:34 
AnswerRe: Unzip file from resources Pin
Daniel Pfeffer21-Aug-18 20:52
professionalDaniel Pfeffer21-Aug-18 20:52 
GeneralRe: Unzip file from resources Pin
JCompiler22-Aug-18 2:33
JCompiler22-Aug-18 2:33 
GeneralRe: Unzip file from resources Pin
Richard Deeming22-Aug-18 2:43
mveRichard Deeming22-Aug-18 2:43 
GeneralRe: Unzip file from resources Pin
JCompiler22-Aug-18 3:05
JCompiler22-Aug-18 3:05 
GeneralRe: Unzip file from resources Pin
JCompiler22-Aug-18 4:30
JCompiler22-Aug-18 4:30 
GeneralRe: Unzip file from resources Pin
Richard Deeming22-Aug-18 4:42
mveRichard Deeming22-Aug-18 4:42 
AnswerRe: Unzip file from resources Pin
jschell25-Aug-18 4:36
jschell25-Aug-18 4:36 

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.