Stored Proc using MS Application Blocs

  • Thread starter Thread starter Schoo
  • Start date Start date
S

Schoo

I have an ASP app that works but I am trying to make a change that is not
working.

The app uses MS Application Data Blocks to call a stored procedure. The way
I originally designed it, the user opens the first screen, selects an item
from a list and the program calls an object I created which then makes a
call the the MS App Block and returns the dataset. This continues to work
fine.

I needed to set up an alternate way to run the application so the user could
type in a parameter in the URL to force it to make the selection without
stopping at the selection form. To simulate this, I created a default.aspx
which simply uses a request.redirect("") to send a URL to the real first
page.

However, when it runs this way I get the following error message:
"Syntax error converting from a character string to a uniqueidentifier"

I stepped through the code and it makes it all the way through the scenario
to the Application Block. With the 'executedataset' version it stops on the
command: dataAdapter.Fill(ds)

I have tried a number of changes including building the solution over again,
using an "Execute Scalar" technique instead and checking the stored proc
with Query Analyser to make sure it works. (SQL2000)

So, does anyone have any ideas? Why will this work one way and not another?
 
it seems there is no code to bind the dataset with the control which display
the result on the webpage, usallly it is data grid control
 
That error message should be from database server . you can sql profile get
the request which sent to database. there is syntax error in the sql
statement what you sent to the database server.
 
Thanks for Russel's quick response.

Hi Schoo,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that your ASP.NET web application throws an
exception saying "Syntax error converting from a character string to a
uniqueidentifier" after you used request.redirect("") in your code. If
there is any misunderstanding, please feel free to let me know.

It's hard to tell why this happens. Could you tell me what kind of
exception it is, so that I can decide where the exception was thrown? And
could you paste your code and stored procedure here? It will be much easier
for us to troubleshoot with the code. If this is a SQL server error
message, you can also try Russel's advice to trace with SQL profiler. It
will tell us what is actually executing on the server.

HTH. If the problem persists, please feel free to let me know.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
I fixed the problem. It turned out I was looking at the wrong stored proc.
Once I found the right one, it was obvious what the problem was. I was
doing an inner join on a Guid with a string that did not exist in the
related table. That threw the error message. I fixed the problem and
retested. It all works now.

I guess I have to say that .NET has a very weird way to indicate the problem
lines in debug. It appears to actually go through the problem line and then
fail down the line. So, you never really know which call caused the
problem. This may be because I am using alot of objects that call each
other, so maybe one object thinks everything is fine then all of a suddden
it realizes there has been an error (5 or 6 lines of code have gone by since
that time) and it stops on a line that has nothing to do with the error
messge. In addition, referencing objects that don't exist (maybe haven't
been built yet) does not allow a rebuild to happen properly but the user can
still run the app. This causes the debug mode to run very strangely but you
don't always know that this is the case right away.

I guess this is what they call "experience", eh?

Thanks for your help... I learned something on this one that I can use
later!

Scott
 
Hi Scott,

Thanks for your feedback. I think you can use step into(F11) to go through
the code if you need to going to a method call. Also, if a project build
fails, it still can be run. However, it runs the last built version.

If have any suggestions that could make our products better in the future,
please feel free to send mail to (e-mail address removed). You suggestions will
be highly appreciated. Thanks again for your feedback.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top