|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataTable FillSchema Errorgoes: VB.NET VS 2005 When I try to fill the Dataset, I issue the following commands: Dim objDA As New SqlDataAdapter(query, objConn) objDA.SelectCommand.CommandTimeout = 0 Dim ds As New DataSet objDA.FillSchema(ds, SchemaType.Source) objDA.Fill(ds) I get an error: Failed to enable constraints. One or more rows contain values violating non-null, unique or foreign-key constraints. After pulling the remaining hairs out of my head (which only took a couple of minutes!) , I finally figured out when I send a CASE statement in the query, I get the error. All other queries work just fine. This only errors out when I use the FillSchema command. I found in the Microsoft ADO.NET book by David Sceppa, some code that should trap the FillSchema problem. objDA.MissingSchemaAction = MissingSchemaAction.Error AddHandler objDA.FillError, AddressOf objDA_FillError Public Sub objDA_FillError(ByVal sender As Object, ByVal e As FillErrorEventArgs) MessageBox.Show("You have an error in the Fill Schema Routine " & vbCrLf & e.Errors.Message) e.Continue = True End Sub but it doesn't work. Is there a way to trap errors with the FillSchema command and gracefully handle the error? Thanks, Henry
Other interesting topics
|
|||||||||||||||||||||||