0

I am trying to pass the current time. I am not interested in the date portion.

It must be passed as a DateTime object to be successfully stored in the database.

Using Microsoft access 2003 as a db
Programming language is C#
Vs2017

Community
  • 1
  • 1
123321
  • 53
  • 8

2 Answers2

0

Then you should pass date time parameter to it.

DateTime date_today = DateTime.Now;
SqlCommand sql_command = new SqlCommand("INSERT INTO table (date_time_table) VALUES (@value)", connection);
sql_command.Parameters.AddWithValue("@value", date_today);
sql_command.ExecuteNonQuery();
DeshDeep Singh
  • 1,817
  • 2
  • 23
  • 43
0

i have found the solution

i have setted the default value of my time column to a function called Time$()

and that will enforce the db by it self to add the current time to the new row that i will add every time automatically

if you are passing the same problem and found my answer and need more explanation just comment this answer with your question.

123321
  • 53
  • 8