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

C#

 
GeneralRe: async and await concept Pin
Anil Sharma198328-Sep-15 21:26
professionalAnil Sharma198328-Sep-15 21:26 
AnswerRe: async and await concept Pin
Agent__00728-Sep-15 23:19
professionalAgent__00728-Sep-15 23:19 
AnswerRe: async and await concept Pin
F-ES Sitecore29-Sep-15 1:02
professionalF-ES Sitecore29-Sep-15 1:02 
SuggestionRe: async and await concept Pin
Richard Deeming29-Sep-15 2:14
mveRichard Deeming29-Sep-15 2:14 
Questiongrid control, tile view Pin
Member 1201862628-Sep-15 20:00
Member 1201862628-Sep-15 20:00 
AnswerRe: grid control, tile view Pin
OriginalGriff28-Sep-15 20:11
mveOriginalGriff28-Sep-15 20:11 
QuestionWhy can I save the error information into the table of SQL server ? Pin
Member 245846728-Sep-15 17:40
Member 245846728-Sep-15 17:40 
AnswerRe: Why can I save the error information into the table of SQL server ? Pin
Wendelius28-Sep-15 17:57
mentorWendelius28-Sep-15 17:57 
You didn't post the error message so there's no way of knowing what err you actually encounter.

However, there are some issues with the code:

  • The update statement TABERRORINFO, the the username is concatenated into the SQL statement while all other values are passed as parameters. The username should also be a parameter
  • Does the query update a row. When the ExecuteNonQUery is called, check the return value and see if it is 0 or 1 (or something else). If it's 0 there is no row to update. So the code should be something like
    C#
    int rowsAffected = cmd.ExecuteNonQuery();
    if (rowsAffected != 1) {
       // inform user etc...
    }
    ...

  • Instead of using a single connection for all statements I'd suggest wrapping the operations inside a using block

  • It looks you may store a date in a string column. If that is the case I'd suggest using a datetime data type for dates. This will remove a lot of unnecessary complexity in the code.

GeneralRe: Why can I save the error information into the table of SQL server ? Pin
Member 245846729-Sep-15 17:36
Member 245846729-Sep-15 17:36 
GeneralRe: Why can I save the error information into the table of SQL server ? Pin
Wendelius29-Sep-15 18:15
mentorWendelius29-Sep-15 18:15 
GeneralRe: Why can I save the error information into the table of SQL server ? Pin
Member 24584672-Oct-15 2:56
Member 24584672-Oct-15 2:56 
QuestionSitemapnode(breadcrumb) value changes with multiple users Pin
nitin_ion28-Sep-15 4:09
nitin_ion28-Sep-15 4:09 
AnswerRe: Sitemapnode(breadcrumb) value changes with multiple users Pin
Pete O'Hanlon28-Sep-15 4:58
mvePete O'Hanlon28-Sep-15 4:58 
AnswerRe: Sitemapnode(breadcrumb) value changes with multiple users Pin
Richard Deeming28-Sep-15 6:30
mveRichard Deeming28-Sep-15 6:30 
QuestionPort some C++ code which contains WriteFile to C# Pin
Member 1206160028-Sep-15 1:48
Member 1206160028-Sep-15 1:48 
AnswerRe: WriteFile equivalent in C# Pin
Pete O'Hanlon28-Sep-15 3:00
mvePete O'Hanlon28-Sep-15 3:00 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 3:18
Member 1206160028-Sep-15 3:18 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 3:21
Member 1206160028-Sep-15 3:21 
GeneralRe: WriteFile equivalent in C# Pin
Dave Kreskowiak28-Sep-15 3:40
mveDave Kreskowiak28-Sep-15 3:40 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 3:55
Member 1206160028-Sep-15 3:55 
GeneralRe: WriteFile equivalent in C# Pin
Dave Kreskowiak28-Sep-15 4:09
mveDave Kreskowiak28-Sep-15 4:09 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 4:15
Member 1206160028-Sep-15 4:15 
GeneralRe: WriteFile equivalent in C# Pin
Dave Kreskowiak28-Sep-15 4:25
mveDave Kreskowiak28-Sep-15 4:25 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 4:32
Member 1206160028-Sep-15 4:32 
GeneralRe: WriteFile equivalent in C# Pin
Dave Kreskowiak28-Sep-15 7:07
mveDave Kreskowiak28-Sep-15 7:07 

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.