Removing this section and keeping the rest will still print the SQLite error being generated, which will note the column that has the problem.Įnsure the fields named in the table adapter query match those in the query you have defined. If you're confused about the PKColumns section above - this prints out column names and values, and is not necessary, but adds helpful troubleshooting info for identifying which column values may be causing the issue.
The output looks like this: Row FIRST_NAME: 'HOMER', LAST_NAME: 'SIMPSON', MIDDLE_NAME: 'J', has error: Column 'HAIR_COLOR' does not allow DBNull.Value. In my case, since all my datatables know their PK cols I can write debug for these errors automatically for all tables. If you know the Primary Key columns in your datatable you can loop through them here. Oops - sorry PKColumns is something I added when I extended DataTable that tells me all the columns that make up the primary key of the DataTable. foreach (DataRow dr in dataTable)įoreach (DataColumn dc in dataTable.PKColumns)ĭebug.Write(dc.ColumnName + ": '" + dr.ItemArray + "', ") ĭebug.WriteLine(" has error: " + dr.RowError)
This is in C#, but converting it to VB should not be hard. This will find all rows in the table that have errors, print out the row's primary key and the error that occurred on that row. Or in C# it would be ? dataTable.GetErrors().RowError So, to see the error of the first datarow in error the command is: You can get then look at the RowError for each of these, which should tell you the column that's invalid along with the problem. This will show you all datarows which have an error. Then within the command window, call GetErrors method on the table getting the error.įor C#, the command would be ? dataTable.GetErrors()įor VB, the command is ? dataTable.GetErrors
Or, to see the exact error, you can manually add a Try/Catch block to the generated code like so and then breaking when the exception is raised: If you've eliminated null values, then my guess is that the primary key columns is being duplicated. Try running your query natively and look at the results, if the resultset is not too large. size of char fields) between the database and the dataset duplicate rows being returned with the same primary key.null values being returned for columns not set to AllowDBNull.This problem is usually caused by one of the following So I solve my problem by replacing e.eval to, NVL (e.eval,'') eval.and this solves my problem. ? dt.GetErrors() RowError: "Column 'eval' does not allow DBNull.Value." The primary key is (batch_no, crsnum, lect_code). The problem happens with the table cc1assiscrseval. The second table I make the outer join on contains a composite primary key which are null in the previous outer join query.ĮDIT: SELECT UNIQUE a.crs_e, a.crs_e || '/ ' || a.crst crs_name, b.period,ī.crscls, c.crsday, c.from_lect, c.to_lect,Ĭ.to_lect - c.from_lect + 1 Subtraction, c.lect_kind, e.eval, e.batch_no,įROM rlm1course a, rfc14crsgrp b, ckj1table c, mnltablelectev d,
I know the problem, but I don't know how to fix it. Violating non-null, unique, or foreign-key constraints. I make an outer join and executed successfully in the informix database but I get the following exception in my code: DataTable dt = TeachingLoadDAL.GetCoursesWithEvalState(i, bat) įailed to enable constraints.