Gopal
Gopal

Reputation: 11982

How to modify the value in the database

Using SQL Server and VB6

Table1

Date Time

20090801 060000
20090802 162000

Date Format: yyyymmdd Time Format: HHMMSS

Date & Time Column Datatype is varchar

When i select a Date in a Datetimepicker and modify the time. The should update in the table.

Expected Output

01-08-2009 (DatetimePicker value)
080000 (Textbox value)

The Above value should update in the table

How to make a code for the above condition.

Need code help.

Upvotes: 0

Views: 172

Answers (1)

dretzlaff17
dretzlaff17

Reputation: 1719

Try something like this.

Dim strDateTime as string

strDateTime = Format$(DateTimePicker.Value, "MMDDYYYY mmhhss")

Update our the database with a recordset

rs.Fields["DateTimeField"] = strDateTime
rs.Update'

I hope this points you in the right direction

Upvotes: 1

Related Questions