-
Sep 12th, 2015, 03:00 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Need Help: Insert null value
I am using Vb6 and Mysql database
I am having a problem on saving null value on date field.
If it has a date it saves, and if doesn't have it also saves but when
I tried to look at the database table instead of Null it become 0000-00-00.
How do I set it as Null?
Code:
Dim sDateEnd As String
If txtDates(1).Text <> "mm/dd/yyyy" Then
sDateEnd = Format(txtDates(1).Text, "yyyy-MM-dd")
Else
sDateEnd = ""
End If
strUpdate = "INSERT INTO tbl_employees (tsk_end) VALUES (" _
& "'" & IIf(IsNull(sDateEnd), Null, sDateEnd) & "'" _
& ")"
conn.Execute strUpdate
ANY Help?
Last edited by morbid.ivan; Sep 12th, 2015 at 03:04 AM.
-
Sep 12th, 2015, 10:05 PM
#2
Thread Starter
Hyperactive Member
Re: Need Help: Insert null value
Thank you for viewing... I solve it.
Code:
Dim sDateEnd As String
If IsDate(txtDates(1).Text) Then
sDateEnd = Format(txtDates(1).Text, "yyyy-MM-dd")
Else
sDateEnd = "NULL"
End If
strUpdate = "INSERT INTO tbl_employees (tsk_end) VALUES (" _
& "date('" & sDateEnd & "') " _
& ")"
conn.Execute strUpdate
-
Sep 12th, 2015, 10:12 PM
#3
Thread Starter
Hyperactive Member
Re: [RESOLVED] Need Help: Insert null value
and also this:
Code:
date(IfNull(Null,'" & Format(txtDates(1).Text, "yyyy-MM-dd") & "'))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|