Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SaveEntitiy() tries to insert NULLS
Message
De
15/12/2009 09:57:50
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
SaveEntitiy() tries to insert NULLS
Versions des environnements
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01439152
Message ID:
01439152
Vues:
104
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."
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform