James Hulse
James Hulse

Reputation: 1581

Is it possible to retrieve the line number from an OleDbException caused by calling ExecuteNonQuery()?

We are calling ExecuteNonQuery on all files in a certain folder for version scripting and if there is a syntax error an exception is raised. I have been scanning MSDN for a way to get the line number but haven't been able to find anything yet. There is a 'SqlException' class which does contain the line number but the shared base class 'DbException' does not contain this member.

Upvotes: 1

Views: 75

Answers (1)

Kieren Johnstone
Kieren Johnstone

Reputation: 42003

Use the SqlConnection, SqlCommand classes rather than OleDbConnection, OleDbCommand classes when accessing SQL Server.

Upvotes: 1

Related Questions