Click here to Skip to main content
15,904,024 members
Home / Discussions / C#
   

C#

 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Eddy Vluggen27-Mar-19 3:35
professionalEddy Vluggen27-Mar-19 3:35 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Pete O'Hanlon27-Mar-19 3:50
mvePete O'Hanlon27-Mar-19 3:50 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Eddy Vluggen27-Mar-19 4:15
professionalEddy Vluggen27-Mar-19 4:15 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Richard MacCutchan27-Mar-19 4:33
mveRichard MacCutchan27-Mar-19 4:33 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Eddy Vluggen27-Mar-19 4:38
professionalEddy Vluggen27-Mar-19 4:38 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Richard MacCutchan27-Mar-19 5:05
mveRichard MacCutchan27-Mar-19 5:05 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Eddy Vluggen27-Mar-19 5:31
professionalEddy Vluggen27-Mar-19 5:31 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Gerry Schmitz27-Mar-19 6:16
mveGerry Schmitz27-Mar-19 6:16 
AnswerRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
dan!sh 27-Mar-19 3:58
professional dan!sh 27-Mar-19 3:58 
GeneralRe: OData InvalidOperationException. Bad Request - Error in query syntax Pin
Bastien Vandamme28-Mar-19 15:01
Bastien Vandamme28-Mar-19 15:01 
QuestionRestore fingerprint data for timekeeper Ronald jack x628-C ? Pin
Member 245846725-Mar-19 16:30
Member 245846725-Mar-19 16:30 
AnswerRe: Restore fingerprint data for timekeeper Ronald jack x628-C ? Pin
Pete O'Hanlon25-Mar-19 21:42
mvePete O'Hanlon25-Mar-19 21:42 
GeneralRe: Restore fingerprint data for timekeeper Ronald jack x628-C ? Pin
Member 245846726-Mar-19 16:28
Member 245846726-Mar-19 16:28 
AnswerRe: Restore fingerprint data for timekeeper Ronald jack x628-C ? Pin
OriginalGriff26-Mar-19 21:24
mveOriginalGriff26-Mar-19 21:24 
AnswerRe: Restore fingerprint data for timekeeper Ronald jack x628-C ? Pin
OriginalGriff25-Mar-19 22:54
mveOriginalGriff25-Mar-19 22:54 
QuestionExport from DataGridView to access _ c# Pin
Member 1419439024-Mar-19 12:15
Member 1419439024-Mar-19 12:15 
AnswerRe: Export from DataGridView to access _ c# Pin
josda100024-Mar-19 15:41
josda100024-Mar-19 15:41 
AnswerRe: Export from DataGridView to access _ c# Pin
OriginalGriff24-Mar-19 21:10
mveOriginalGriff24-Mar-19 21:10 
GeneralRe: Export from DataGridView to access _ c# Pin
Member 1419439024-Mar-19 22:11
Member 1419439024-Mar-19 22:11 
GeneralRe: Export from DataGridView to access _ c# Pin
OriginalGriff24-Mar-19 22:40
mveOriginalGriff24-Mar-19 22:40 
QuestionQuestion about login form with access database Pin
Member 1114879324-Mar-19 1:42
Member 1114879324-Mar-19 1:42 
AnswerRe: Question about login form with access database Pin
OriginalGriff24-Mar-19 2:03
mveOriginalGriff24-Mar-19 2:03 
Before you start moving on to levels and rules, you have got to fix that first - it's very bad code.
1) 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?

2) Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^]

3) Don't hardcode connections strings. If you do, then you have to change your code and rebuild for release, and potentially for every different installation. Use a configuration file instead, so it;s easy to update without changing your code.

4) Don't use SELECT * FROM ... - always name the columns you want to return. In this case, SELECT COUNT(User) FROM ... would have been sufficient. You are returning information you already have and that's wasteful. It's not a problem right now, but it will be in "real world" apps so it's worth getting into the habit of doing it correctly from the beginning.

5) Don't use a DataAdapter to return a single piece of info: use ExecuteScalar instead, which returns a single value.

When you have fixed that lot, then think about moving forward.
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!

QuestionMessage Removed Pin
23-Mar-19 12:08
Member 1419354023-Mar-19 12:08 
QuestionCzytanie z drukarki Posnet / Receive Posnet POS printer answer Pin
OraToraCora21-Mar-19 13:24
OraToraCora21-Mar-19 13:24 
AnswerRe: Czytanie z drukarki Posnet / Receive Posnet POS printer answer Pin
Luc Pattyn21-Mar-19 15:37
sitebuilderLuc Pattyn21-Mar-19 15:37 

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.