get the sql statement

  • Thread starter Thread starter Afton Wynona
  • Start date Start date
A

Afton Wynona

How can I get the actual SQL statement rather than this sh@thole error?

Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Data type mismatch in
criteria expression.

Source Error:

Line 265: Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Line 266: saveImages()
Line 267: FormView1.InsertItem(True)
Line 268: End Sub
Line 269: Protected Sub btnPanel1Cancel_Click(ByVal sender As Object,
ByVal e As System.EventArgs)
 
It's hard to tell, with the little information you provided....
The main thing is that, since it's a datatype mismatch - just look at the
data for each field, then check the Database table to see if the datatypes
match - I'm willing to bet you're trying to enter information that the table
wasn't made to have entered.
 
well no kidding.
How about the question that I asked. Do you have any information on that?
 
You might want to try a different approach. If you're going to be like that
to someone who is taking their valuable time to answer you, why should they
bother.

Chances are, you can't get the SQL since it's not the framework that's
throwing the error, it's the database itself, which has no need to make the
SQL statement available. If you're connecting to a database that has a
profiler tool, such as the SQL Server Profiler for SQL Server, you can
capture the entire communication and the actual query that's sent to the db.
You can then run this query directly against the db and see what it responds
then. Usually in these cases the database isn't going to give you any answer
as to what's going on and you just have to figure out which datatype is
incorrect on your own. If it's a stored procedure I often iterate through
all the parameters and their values so I have a list of what's getting
passed and compare it to the stored procedure parameter list. Usually I'm
off because I've jumped an element in the parameter array.
 
yes, that does help.

I ought to be able to get from ASPX the statement that ASPX is sending to
the database, even though I might not be able to get the statement from the
database.
(I used to be able to do it with ASP).

Next, as far as being rude, believe me I am doing the world a favor by
discouranging people from posting ill-thought out, irrelevant answers that
are nothing but time wasters.
 
Back
Top