Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6100893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:26:16+00:00 2026-05-23T13:26:16+00:00

I have a big stored procedure that I run. At the end its supposed

  • 0

I have a big stored procedure that I run. At the end its supposed to select a singe value to say if it succeeded or not, so I run the query as

Dim Command As New SqlCommand(SqlString, Conn)
Return Command.ExecuteScalar()

Which works. However there is an error in my stored procedure. I know its causing an error because the logic in the stored procedure rolls back the transactions, and after the Execute Scalar call, my transaction count is down to 0 and the my data hasn’t changed. However no SQL exception was generated.

The strange part is, I changed the code to grab all the result sets from the SP to see if I could get more information. So I called the same SP like this,

    Dim DAObj As SqlDataAdapter = New SqlDataAdapter
    Dim CommandObj As SqlCommand = New SqlCommand(SQLString, Conn)
    DAObj.SelectCommand = CommandObj
    Dim DS As New DataSet()
    DAObj.Fill(DS)

When I run this, with the exact same sql as before, executing the exact same stored procedure, this time I get an SQL exception because one of my nested SP calls was missing required parameters.

So what could cause this? Why would running it one way produce an error and the other way have the error but not report it? Is the difference on purpose, or some kind of obscure bug in ADO.Net?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:26:16+00:00Added an answer on May 23, 2026 at 1:26 pm

    A DataAdaptor consumes all datasets that come back from the client. An exception is a dataset too.

    ExecuteScalar consumes the 1st row, 1st column, 1st dataset only.

    • Don’t use ExecuteScalar
    • Keep consuming DataReaders until you get no more back
    • Use DataAdaptor.Fill (DataSet). It will skip exceptions for filling DataTables too
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to do a big update script - not an SPL (stored procedure).
i have a big t-sql stored procedure with this part that i am concerned
i have a stored procedure that takes 2 parameters: ID and Date. when i
I'm not a real big TSSQL expert. We have a query that returns almost
I have a stored procedure that updates two tables. The first table is always
I want to write a stored procedure that queries XML files after I have
I currently use SQL2008 where I have a stored procedure that fetches data from
I have a NVARCHAR(max) column in a table and a stored procedure that would
I have a php web application that uses big cookies to store a lot
I have big system that make my system crash hard. When I boot up,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.