Guest_imported
New member
- Jan 1, 1970
- 0
- 0
- 0
hi ,
I have created a data entry form in visual basic....
And from there i am inserting the data into the database table through
insert into ** ** values ( here the fields.txt is given )
Now if the data entry operator leaves any fields empty this does not work since it requires value for every field written in the insert statement..
Now the task is to check whether the field is empty or not and then suitably calling the insert statement..
I have been doing it like this
f Len(txtaddress.Text) = 0 Then
txtaddress.Text = " "
End If
If Len(txtcity.Text) = 0 Then
txtcity.Text = " "
End If
If Len(txtphonenumber.Text) = 0 Then
txtphonenumber.Text = "0"
End If
If Len(txtemail.Text) = 0 Then
txtemail.Text = " "
End If
If Len(txtoccupation.Text) = 0 Then
txtoccupation.Text = " "
End If
If Len(txtrefby.Text) = 0 Then
txtrefby.Text = " "
End If
i.e i check the length of the field and if it is 0 then i put a space in it and the simple one line insert into statement works...
I know that this is an inefficient approach.. Can anybody tell me a better method... for this..
I have created a data entry form in visual basic....
And from there i am inserting the data into the database table through
insert into ** ** values ( here the fields.txt is given )
Now if the data entry operator leaves any fields empty this does not work since it requires value for every field written in the insert statement..
Now the task is to check whether the field is empty or not and then suitably calling the insert statement..
I have been doing it like this
f Len(txtaddress.Text) = 0 Then
txtaddress.Text = " "
End If
If Len(txtcity.Text) = 0 Then
txtcity.Text = " "
End If
If Len(txtphonenumber.Text) = 0 Then
txtphonenumber.Text = "0"
End If
If Len(txtemail.Text) = 0 Then
txtemail.Text = " "
End If
If Len(txtoccupation.Text) = 0 Then
txtoccupation.Text = " "
End If
If Len(txtrefby.Text) = 0 Then
txtrefby.Text = " "
End If
i.e i check the length of the field and if it is 0 then i put a space in it and the simple one line insert into statement works...
I know that this is an inefficient approach.. Can anybody tell me a better method... for this..