hi all, i am using ms access as my database. I have many textboxes for user entry and some of those text boxes might me empty too.
So i just tested if i can insert a null value into a database if the textfield is empty with 4 textboxes.
For Each control As Control In Me.Controls
If control.Text = "" Then
control.Text = "NULL"
End If
Next
cmd = New OleDbCommand("Insert into hhh(CustomerID,name,Date,Org) values ('" & txtCustomerID.Text & "','" & txtCustomerName.Text & "','" & txtDate.Text & "','" & txtOrg.Text & "')", Myconn)
cmd.ExecuteNonQuery()
i got an error while inserting into database if i do this, i know the syntax might be wrong or something else ..
Any suggestions please as to how to do it ...
Thanks for your time ....
So i just tested if i can insert a null value into a database if the textfield is empty with 4 textboxes.
For Each control As Control In Me.Controls
If control.Text = "" Then
control.Text = "NULL"
End If
Next
cmd = New OleDbCommand("Insert into hhh(CustomerID,name,Date,Org) values ('" & txtCustomerID.Text & "','" & txtCustomerName.Text & "','" & txtDate.Text & "','" & txtOrg.Text & "')", Myconn)
cmd.ExecuteNonQuery()
i got an error while inserting into database if i do this, i know the syntax might be wrong or something else ..
Any suggestions please as to how to do it ...
Thanks for your time ....