Problem Updating a Field

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?
 
B

Brendan Reynolds

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top