insert time

insert only time not the date part in sql

Page 1 of 1

1 Replies - 3984 Views - Last Post: 14 May 2009 - 10:19 PM Rate Topic: -----

#1 anirai  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 40
  • Joined: 14-May 09

insert time

Posted 14 May 2009 - 10:03 PM

cmd.Parameters.AddWithValue("@late_Time", Convert.ToDateTime(ListView1.Items(i).SubItems(12).Text).ToShortTimeString())


this my code to insert into sql ..subitem(12) contains time ..for eg:10:00:00
when i insert then date is also inserted...
is there a way to insert only the time part in sql database table ....
Is This A Good Question/Topic? 0
  • +

Replies To: insert time

#2 ashishshevale  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 92
  • Joined: 14-April 09

Re: insert time

Posted 14 May 2009 - 10:19 PM

View Postanirai, on 14 May, 2009 - 09:03 PM, said:

cmd.Parameters.AddWithValue("@late_Time", Convert.ToDateTime(ListView1.Items(i).SubItems(12).Text).ToShortTimeString())


this my code to insert into sql ..subitem(12) contains time ..for eg:10:00:00
when i insert then date is also inserted...
is there a way to insert only the time part in sql database table ....

a text canot be converted to date time object corectly
so the problem
you can use substring on the string you get and show the time though the crude way it works
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1