SQL-VB Interface

  • While inserting date into a SQL Server table from a form in Visual Basic, what to do to insert only time without date

  • If you pass the date as a string with no time components and use a convert function in the inset statement, it will have no time value.

    Thom Pantazi

  • one more way is use

    Format(date,"dd-mmm-yyyy") (function in VB)

    one more example....

    Format(form1.dtpSDate.Value, "dd-mmm-yyyy")

  • Both are valid, just depends on where is the best place. If you ALWAYS want the value to just be the time portion, I'd say do in a procedure. If sometimes yes and sometimes no, keep the proc inserting the date however is passed, do the formatting in the app.

    Andy

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply