Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SaveEntitiy() tries to insert NULLS
Message
From
15/12/2009 09:57:50
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
SaveEntitiy() tries to insert NULLS
Environment versions
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01439152
Message ID:
01439152
Views:
105
We have an issue with a desktop WinApp application where we are trying to insert a new record using the BO. When we click a button to save the entity using the SaveEntity() method a message is returned that we are trying to insert NULL values into the table. I've confirmed using SQL Profiler that indeed all the values are NULL.

However, right up until the SaveEntity() is executed, even through the validations, I can see the entity does contain the values. I'm unclear why the actual execution of the SQL INSERT loses the values in the Entity. I've included some basic code below where I'm trying to prove and resolve my problem. Can anyone advise on what I might be missing with the following code that would cause this problem?

Me.mdacAttorney.NewEntity()
With mdacAttorney.Entity
.fname = txFname.Text
.lname = txLname.Text
.mname = txMidInit.Text
.addr1 = txAddr1.Text
.addr2 = txAddr2.Text
.city = txCity.Text
.state = txState.Text
.zip = txZip.Text
.Isactive = CType(cmbActive.SelectedValue, Boolean)
.Isdeleted = False
.phone = txPhone.Text
.fax = txFax.Text
.contact_notes = txNotes.Text
.createdOn = DateTime.Now
.createdBy = "Graeme"
End With
mdacAttorney.SaveEntity()

The error message I am getting is "Cannot insert the value NULL into column 'addr1', table 'MedicalModule.dbo.attorney'; column does not allow nulls. INSERT fails. The statement has been terminated."
Next
Reply
Map
View

Click here to load this message in the networking platform