[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1656
  • 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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