Problem Updating a Field

  • Thread starter Thread starter Will Lastname
  • Start date Start date
W

Will Lastname

I am working on a VB.net application that allows the system
administrator to assign users to software suites and licenses. One of
the features that I am working on now is the 'Remove User' option. What
this does is make the license available after the software is removed
via SMS. I am attempting to find the field that corresponds to the
selected ID and set the Employee Name to null. The field allows null
values but I can getting an error. Here is my SQL string:

Dim strEmployeeName as string = ""

Dim strSQL as string = "UPDATE tblSoftware Set EmployeeName = '" &
strEmployeeName & "' WHERE ID = " & intEmployeeID & ";"

Any suggestions as to how I can alleviate this error message?
 
This code is not attempting to set the EmployeeName field to Null, it is
attempting to set it to an empty string. If you want to set the field to
Null, change the SQL statement to "SET EmployeeName = Null". If you want to
set the field to an empty string, check that the Allow Zero Length property
of the field is set.
 
Back
Top