Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

Insert Statement VS NULL

$
0
0
Hi,

My code works fine, however, if no value is typed to a textbox -txtliceffdate , it stores 01/01/00 00:00:00 (default) at the backened table instead I want for every not populated value i.e., data not typed in the textbox, to have a NULL value.. Is is possible? The txtliceffdate has a datetime datatype and accepts NULL values.

Code:

query = "INSERT INTO dbo.tblOrganisation (OrganisationName, AddressLine1, AddressLine2, AddressLine3, Town, PostCode,Country, TelephoneNo, MobileNo, FaxNo, EmailAddress, LicenceEffectiveDate, LicenceExpiryDate, Status, DateDisabled, Notes ) VALUES ('" & _
                                                txtorgname.Text.Replace("'", "''") & "', '" & _
                                                txtAdd1.Text.Replace("'", "''") & "', '" & _
                                                txtAdd2.Text.Replace("'", "''") & "', '" & _
                                                txtAdd3.Text.Replace("'", "''") & "', '" & _
                                                txtTown.Text.Replace("'", "''") & "', '" & _
                                                txtPostCode.Text & "', '" & _
                                                cmbcountry.Text & "', '" & _
                                                txtWorkNo.Text & "', '" & _
                                                txtMobileNo.Text & "', '" & _
                                                txtFaxNo.Text & "', '" & _
                                                txtEmail.Text.Replace("'", "''") & "', '" & _
                                                txtliceffdate.Text & "', '" & _
                                                txtexpdate.Text & "', '" & _
                                                cmbStatus.Text & "', '" & _
                                                txtdatedisabled.Text & "', '" & _
                                                txtNotes.Text.Replace("'", "''") & "')"

Thanks

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>