Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8732745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:29:38+00:00 2026-06-13T09:29:38+00:00

I have made a small application where i save students data. I installed it

  • 0

I have made a small application where i save students data. I installed it on my PC and it worked just fine.

I gave it to one of my friend to install it on his system, however his windows is in German language, he installed the software perfectly, but when he was trying to store the data he got the error for date field.

What he explained me on the phone that it was a language error as when i was storing the data on my computer which is in English language, date time appeared like this:

enter image description here

Now when he installed my app on his computer the Date of birth field was in German Language and so he got an error while mssql insert query.

My question is how to force the application to use the Date time in just English language as a System time and not that the client language date time?

I am using sqlServerCe

EDIT

QueryGrid("INSERT INTO students (p_num, p_name, p_fname, p_dob, p_street, p_zip, p_phone, p_email, p_sex, p_comment, p_fax, p_pic, p_regdate, p_idc) VALUES('" + p_num.Text + "', '" + p_name.Text + "', '" + p_fname.Text + "', '" + p_dob.Value + "', '" + p_street.Text + "', '" + p_zip.Text + "', '" + p_pno.Text + "', '" + p_email.Text + "', '" + gender + "', '" + comment_box.Text + "', '" + p_fno.Text + "', '" + p_num.Text + "', '" + DateTime.Now + "', '" + p_idc.Text + "')")
MessageBox.Show("Student successfully added in database.")

Now in above code p_dob.Value is my date value. and when i use it on my computer it converts the above Monday, October 22, 2012 to 10/22/2012 11:31 AM and saves into database, now on my friends system its in German language, so its unable to convert and save.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:29:39+00:00Added an answer on June 13, 2026 at 9:29 am

    As I said in mycomment, you should never write a query concatenating string: use queries with parameters.
    Example:

    string query = "INSERT INTO mytable (p_num, p_date) SELECT @num,@dt";
    using (SqlConnection conn = new SqlConnection("....."))
    {
        conn.Open();
        using (SqlCommand cmd = new SqlCommand(query, conn))
        {
            cmd.Parameters.AddWithValue("num", 1);
            cmd.Parameters.AddWithValue("dt", DateTime.Today);
    
            cmd.ExecuteNonQuery();
        }
        conn.Close();
    }
    

    Naturally this is only part of the code, but should give you an idea.
    Concatenating strings can lead you to many troubles, not only with dates but with doubles too.

    In general: write queries using params to avoid problems with localization (and others).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a small method to display the installed application name in android.
I have made a small application in Java and I would like to make
I have just started programming and have made a few small applications in C
Post-release, I have made one small change to one form in our development site
i have made a small web application with form.html output.jsp ServletOne.java In the form.html,users
I have made a small windows application with visual studio 2008 ,its working properly
I have made a small application in Windows Azure. For research purposes they asked
I have made a small Java .jar GUI application. When I run it on
I have made a small application on a school. Where there is a dropdown
I have made a small swing application for my personal use. This app connects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.