Link to home
Start Free TrialLog in
Avatar of Alfredo Luis Torres Serrano
Alfredo Luis Torres SerranoFlag for United States of America

asked on

VB .Net and Datasets

Hi Experts,

  I have a combobox control  that have a datasource created with the datasource wizard and basiccly is:

SELECT DISTINCT '-Seleccione-' As Login FROM CMS
Union All
SELECT Distinct rtrim(Login) FROM CMS WHERE Convert(Smalldatetime,Fecha,103) Between Convert(Smalldatetime,@FechaI,103) And Convert(Smalldatetime,@FechaF,103) Order By login Desc

After i call
CMSTableAdapter.Fill(Db_AsistenciaDataSet.CMS, Format(DateTimePicker1.Value, "dd/MM/yyyy"), Format(DateTimePicker2.Value, "dd/MM/yyyy"))
An exception is  thrown telling me:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
But the dataset is filled (The combobox is filled).

Any idea
Thanks


        CMSTableAdapter.Fill(Db_AsistenciaDataSet.CMS, Format(DateTimePicker1.Value, "dd/MM/yyyy"), Format(DateTimePicker2.Value, "dd/MM/yyyy"))

An exception is theown telling me that:

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints

But the combobox is filled.

Any idea?
Thanks



Avatar of James Murrell
James Murrell
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alfredo Luis Torres Serrano

ASKER

cs97jjm3: None of the 3 cases expained on you post is my case i just have one table and that table does not have any key field and all field accept nulls and the query runs perfect on a query window.

TheLearnedOne: I have no keys on that table but your post help me to find a solution that was:

        Db_AsistenciaDataSet.EnforceConstraints = False just before fill the dataset.

Thanks