• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1811
  • Last Modified:

Error message : Row must have at least one column value set.

First off, thanks for clicking

the error message I get is this in vb.net

"Empty row cannot be inserted. Row must have at least one column value set."

Have a form with an "classic" Adodc9 control on it. Converted over from vb6.

It linked to a table with a primary key and several Text fields with AllowZeroLength = No

When I click the New button it runs this code fine Adodc9.RecordSet.AddNew.

Upon clicking the New button it clears all the bound Textboxes on the form.

The error is caused by clicking the Save button and running Adodc9.Recordset.Update.

However, when I type something into one of the Textboxes it updates fine.

Adodc9.Recordset.EditMode = adEditAdd before running .Update

This is the info in the Err handler

? err.Description
"Empty row cannot be inserted. Row must have at least one column value set."
? err.Number
-2147467259
? err.Source
"Microsoft Cursor Engine"

Does anybody know of a way around this since we need the user to be able to save all the fields blank if they so wish??

many thanks all,
Stuart
0
StuartK
Asked:
StuartK
  • 2
1 Solution
 
Corey ScheichDeveloperCommented:
You need atleast one unique id in each row, it can be autogenerated, otherwise if you have 2 completely blank rows how are you or the db controls to tell one from the other.  This row doesn't have to be accessible or even viewable to the user. Once you have this record identifying row you can have everything else blank.

Corey2
0
 
Corey ScheichDeveloperCommented:
One thing you could do is not have it try to save the new row to the database until it has some relevant data. So add an if statement that would check the values and not send the save until there is actually some data to save.
0
 
StuartKAuthor Commented:
Corey,

Thanks very much.

Have added in a invisible textbox and bound to the primary key.

Thanks so much

Stuart
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now