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 725319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:19:25+00:00 2026-05-14T06:19:25+00:00

I Have a DataBase in my project With Table named ‘ProcessData’ and columns named

  • 0

I Have a DataBase in my project With Table named ‘ProcessData’ and columns named ‘Start_At’ (Type: DateTime) and ‘End_At’ (Type: DateTime) .
When I try to enter a new record into this table, it enter the data in the following format: ‘YYYY/MM/DD HH:mm’, when I actualy want it to be in that format: ‘YYYY/MM/DD HH:mm:ss’ (the secondes dosen’t apper).
Does anyone know why, and what should I do in order to fix this?

Here is the code I using:

con = new SqlConnection("....");
String startAt = "20100413 11:05:28";
String endAt = "20100414 11:05:28";
...
con.Open();//open the connection, in order to get access to the database
SqlCommand command = new SqlCommand("insert into ProcessData (Start_At, End_At) values('" +  startAt + "','" + endAt + "')", con);
command.ExecuteNonQuery();//execute the 'insert' query.
con.Close();

Many thanks

  • 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-05-14T06:19:25+00:00Added an answer on May 14, 2026 at 6:19 am

    Use parametrized queries instead of building up the query using string concat like you’re doing now.

    SqlCommand command = new SqlCommand();
    command.Connection = someConnectionObj;
    command.CommandText = "INSERT INTO Sometable (datecolumn) VALUES (@p_date)";
    command.Parameters.Add ("@p_date", SqlDbType.DateTime).Value = someDate;
    command.ExecuteNonQuery();
    

    Also, use real dates (DateTime datatype) instead of strings that look like to be a date.

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

Sidebar

Ask A Question

Stats

  • Questions 500k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer private static bool IsObjectEqualsMethod(MethodInfo m) { return m.Name == "Equals"… May 16, 2026 at 2:07 pm
  • Editorial Team
    Editorial Team added an answer Try getting Whitelisted. From the rate-limiting documentation: Whitelisting Some applications… May 16, 2026 at 2:07 pm
  • Editorial Team
    Editorial Team added an answer There is no per-application limit so to say. The amount… May 16, 2026 at 2:07 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have some database tables named Project , Employee and Branch . An employee
I have a project in C# with a Sql-server Database. In that database I
Currently, I have a database access class named DB , which uses PDO .
I have a class named project with the following data members. class Project {
I am designing a database and recently named a column in a table DayOfWeek,
I am trying to access database from a Class Library Project. I have connection
I have a new Visual Studio 2008 Database Project (Data Dude). It was generated
I have a project which uses strongly typed datasets. Let's assume I want to
I have a EDM that was wizard generated from an SQL 2005 Express database.
We have a project that needs to gather survey data. On one particular page

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.