472,111 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

Trying to debug an exception

Hello. Every now and then (it's rare), i get an exception when calling
SqlDataAdapter.Fill. The code is calling a stored procedure and
attempts to stuff the results into a dataset. It yields the following
exception. I am trying to understand what the exception is actually
complaining about. Is it a problem with the data that came back or is
it an issue inside the stored procedure? Any alternative ways to nail
down this issue would also be appreciated.
7/18/2005 4:29 PM System.Data.SqlClient.SqlException: Invalid column
name 'OL_ID'.
at System.Data.SqlClient.SqlDataReader.Read()
at System.Data.SqlClient.SqlDataReader.NextResult()
at System.Data.Common.DbDataAdapter.FillNextResult(ID ataReader
dataReader)
at System.Data.Common.DbDataAdapter.FillFromReader(Ob ject data,
String srcTable, IDataReader dataReader, Int32 startRecord, Int32
maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillFromCommand(O bject data,
Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at CC.Viper.DataLayer.Database.CreateDataSet(SqlComma nd command) in
C:\Code.Net\Application\Data Layer\Database.cs:line 287
at CC.Viper.DataLayer.Database.GetOrderLines(Int32 inserterID,
DateTime occasionStartDate, DateTime occasionStopDate, Int32&
resultCode, String& resultText, Int32 debugLevel) in
C:\Code.Net\Application\Data Layer\Database.cs:line 764
Nov 17 '05 #1
4 1355
Frank Rizzo <no**@none.com> wrote:
Hello. Every now and then (it's rare), i get an exception when calling
SqlDataAdapter.Fill. The code is calling a stored procedure and
attempts to stuff the results into a dataset. It yields the following
exception. I am trying to understand what the exception is actually
complaining about. Is it a problem with the data that came back or is
it an issue inside the stored procedure? Any alternative ways to nail
down this issue would also be appreciated.


I'd try running SQL Profiler while your program is running - that
should show whether or not an error occurred in the stored proc itself.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2
Frank Rizzo wrote:
Hello. Every now and then (it's rare), i get an exception when calling
SqlDataAdapter.Fill. The code is calling a stored procedure and
attempts to stuff the results into a dataset. It yields the following
exception. I am trying to understand what the exception is actually
complaining about. Is it a problem with the data that came back or is
it an issue inside the stored procedure? Any alternative ways to nail
down this issue would also be appreciated.
7/18/2005 4:29 PM System.Data.SqlClient.SqlException: Invalid
column name 'OL_ID'.
at System.Data.SqlClient.SqlDataReader.Read()
at System.Data.SqlClient.SqlDataReader.NextResult()
at System.Data.Common.DbDataAdapter.FillNextResult(ID ataReader
dataReader)
at System.Data.Common.DbDataAdapter.FillFromReader(Ob ject data,
String srcTable, IDataReader dataReader, Int32 startRecord, Int32
maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillFromCommand(O bject data,
Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at CC.Viper.DataLayer.Database.CreateDataSet(SqlComma nd command) in
C:\Code.Net\Application\Data Layer\Database.cs:line 287
at CC.Viper.DataLayer.Database.GetOrderLines(Int32 inserterID,
DateTime occasionStartDate, DateTime occasionStopDate, Int32&
resultCode, String& resultText, Int32 debugLevel) in
C:\Code.Net\Application\Data Layer\Database.cs:line 764


Based on the exception I would guess you are selecting 'OL_ID' from your
table which does not exist.

Try running the stored proc/statement through query analyzer or some
such in the same way as your method would be running it.

HTH
JB
Nov 17 '05 #3
Frank Rizzo wrote:
Hello. Every now and then (it's rare), i get an exception when
calling SqlDataAdapter.Fill. The code is calling a stored procedure
and attempts to stuff the results into a dataset. It yields the
following exception. I am trying to understand what the exception is
actually complaining about. Is it a problem with the data that came
back or is it an issue inside the stored procedure? Any alternative
ways to nail down this issue would also be appreciated.


catch the SqlException and view the Errors collection: that's where
the SqlServer responses are stored. Maybe that will give you a lead
as to where the problem really is.

Hans Kesting
Nov 17 '05 #4
Hans Kesting wrote:
Frank Rizzo wrote:
Hello. Every now and then (it's rare), i get an exception when
calling SqlDataAdapter.Fill. The code is calling a stored procedure
and attempts to stuff the results into a dataset. It yields the
following exception. I am trying to understand what the exception is
actually complaining about. Is it a problem with the data that came
back or is it an issue inside the stored procedure? Any alternative
ways to nail down this issue would also be appreciated.

catch the SqlException and view the Errors collection: that's where
the SqlServer responses are stored. Maybe that will give you a lead
as to where the problem really is.

Hans Kesting


Thank you. I didn't realize SqlException had an errors collection.
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Fredrik Melin | last post: by
10 posts views Thread by Brett | last post: by
6 posts views Thread by tascien | last post: by
3 posts views Thread by Bob Johnson | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.