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

C#

 
AnswerRe: how to load signature pad in c# Pin
OriginalGriff1-Feb-17 21:35
mveOriginalGriff1-Feb-17 21:35 
GeneralRe: how to load signature pad in c# Pin
Daniel Pfeffer1-Feb-17 22:13
professionalDaniel Pfeffer1-Feb-17 22:13 
AnswerRe: how to load signature pad in c# Pin
Richard Deeming2-Feb-17 2:31
mveRichard Deeming2-Feb-17 2:31 
AnswerRe: how to load signature pad in c# Pin
Eddy Vluggen2-Feb-17 2:46
professionalEddy Vluggen2-Feb-17 2:46 
QuestionC#: How to copy excel cell range and chart data to power point slides Pin
Tridip Bhattacharjee31-Jan-17 2:18
professionalTridip Bhattacharjee31-Jan-17 2:18 
AnswerRe: C#: How to copy excel cell range and chart data to power point slides Pin
#realJSOP1-Feb-17 7:05
mve#realJSOP1-Feb-17 7:05 
QuestionHow to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
TarunKumarSusarapu29-Jan-17 23:35
professionalTarunKumarSusarapu29-Jan-17 23:35 
AnswerRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
OriginalGriff30-Jan-17 0:05
mveOriginalGriff30-Jan-17 0:05 
This isn't related to C#, so it's in the wrong place.
But it's a rookie mistake, and I'll answer it as a result.

There is but one solution: change your database.
Never store dates in NVARCHAR columns - always use DATETIME or DATE instead.
If you use the wrong column datatype it's easy to set up, and lazy to get the user data into - but it always gives total nightmares after that - because the data in your DB is not valid, or is not in a consistent format, or is in a different format from that which SQL expects.
Think about it: 10/11/12 is a valid date. But is it 10th Nov 2012, 11th Oct 2012, 12th Nov 2010, or some other value entirely? The only time you can tell is when the user inputs the value, and you use his culture to convert it to a DateTime value - as soon as it arrives in the DB it's too late because you no longer have any idea what date format he used: it could be US: MM/DD/YY, European: DD/MM/YY, or ISO / Japanese YY/MM/DD - and you don't even know that the user is using the same calendar as you so the year could be well different (the Hijri date today is Jumada Al-Awwal 3, 1438)! Or even that he didn't enter "hello, my name is Jackie" which isn't even close to a date.

So when you try to convert it to a date at a later time you are almost guaranteed to get errors because the SQL server will try to convert it using it's culture - and generally you don't even know what culture the server is set to!

Always use appropriate data types - it may be easier for your code to slam in NVARCHAR all the time, but it wastes huge amounts of effort later fixing up the holes it leaves.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
TarunKumarSusarapu30-Jan-17 0:33
professionalTarunKumarSusarapu30-Jan-17 0:33 
GeneralRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
OriginalGriff30-Jan-17 0:45
mveOriginalGriff30-Jan-17 0:45 
AnswerRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
CHill6030-Jan-17 1:44
mveCHill6030-Jan-17 1:44 
GeneralRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
Richard Deeming30-Jan-17 2:09
mveRichard Deeming30-Jan-17 2:09 
GeneralRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
TarunKumarSusarapu30-Jan-17 19:28
professionalTarunKumarSusarapu30-Jan-17 19:28 
GeneralRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
Pete O'Hanlon30-Jan-17 19:43
mvePete O'Hanlon30-Jan-17 19:43 
GeneralRe: How to convert total database columns datetime to date in the format of dd-mm-yyyy Pin
TarunKumarSusarapu30-Jan-17 19:47
professionalTarunKumarSusarapu30-Jan-17 19:47 
Question.net Reading and Saving Very Large Images Pin
JBHowl26-Jan-17 3:27
JBHowl26-Jan-17 3:27 
AnswerRe: .net Reading and Saving Very Large Images Pin
Jochen Arndt26-Jan-17 3:55
professionalJochen Arndt26-Jan-17 3:55 
GeneralRe: .net Reading and Saving Very Large Images Pin
JBHowl26-Jan-17 4:25
JBHowl26-Jan-17 4:25 
GeneralRe: .net Reading and Saving Very Large Images Pin
Jochen Arndt26-Jan-17 6:08
professionalJochen Arndt26-Jan-17 6:08 
AnswerRe: .net Reading and Saving Very Large Images Pin
OriginalGriff26-Jan-17 4:31
mveOriginalGriff26-Jan-17 4:31 
AnswerRe: .net Reading and Saving Very Large Images Pin
Eddy Vluggen26-Jan-17 4:49
professionalEddy Vluggen26-Jan-17 4:49 
QuestionNeed help creating a META file (*.meta) editor Pin
KrazyMonkey Modding25-Jan-17 18:45
KrazyMonkey Modding25-Jan-17 18:45 
SuggestionRe: Need help creating a META file (*.meta) editor Pin
Richard MacCutchan25-Jan-17 21:38
mveRichard MacCutchan25-Jan-17 21:38 
AnswerRe: Need help creating a META file (*.meta) editor Pin
NotPolitcallyCorrect26-Jan-17 1:12
NotPolitcallyCorrect26-Jan-17 1:12 
AnswerRe: Need help creating a META file (*.meta) editor Pin
Dave Kreskowiak26-Jan-17 2:46
mveDave Kreskowiak26-Jan-17 2: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.