Forum Discussion
Does it work if you change it to the below?
Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
return BRApi.Database.ExecuteSql(dbConnApp, sql.ToString, False)
End Using
Most of the other stuff seems unnecessary to me at a quick glance unless it has been simplified for the example.
Hey Daniel, I tried with directly returning the Datatable without storing in variable (whcih was by default) The issue still persists. I am doing the same thing by storing in a variable. But the issue is in running the SQL string query in the Data Table. It throws an error: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
The same SQL query when ran through the Data Adapter Dashboard Component Does not pop out this issue.
Business Rule:
Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
Dim ds As New DataSet
ds.Tables.Clear()
ds.EnforceConstraints = False
Dim dt As DataTable = ds.Tables.Add()
dt = BRApi.Database.ExecuteSql(dbConnApp, sql.ToString, False)
Dim Count As Integer = dt.Constraints.Count
BRApi.ErrorLog.LogMessage(si, "Count: here2") ' Does not generate the error is coming on line in bold
Return dt
End Using
Related Content
- 8 months ago