Q: How can i get the column name which causes the SQLException?
C: I am working with SQL Server. My data which i get from my database is visualized with C#/WPF datagrid/DataTable.
If i want to insert an new datarecord to the database where i for example forgot to put some data in a cell which can not be NULL, i will get an SQLException with the message:
Cannot insert the value NULL into column '%.*ls', table '%.*ls'; column does not allow nulls. %ls fails.
'%.*ls' is replaced automatically by the columnname which causes the SqlException.
Is there a way to get this column name mentioned in the error message. Or does i have to extract it from the message string myself?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire