Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

How to debug a sql statement

I have an insert statement throwing me an error.
I can't for the life of me see what is wrong.

Is there a way to debug the statement, the error only tells me that I have a bad insert statement.

I can't response.write(sql) to see whats going on because the sql doesn't run.

in other words, can I debug somehow before executing?

sql = "INSERT INTO [EmergencyResponse] ([BuildingName],[RoomID],[FloorNum],[RoomDesc],[UMC],[ContactName],[ContactUSUPhone],[ContactHomePhone],[ContactEmail],[AltContactName],[AltContactUSUPhone],[AltContactHomePhone],[FireExtLocation],[MSDSInfoLocation],[NumFumeHoods],[NumBioCabinets],[FlamCombustMaxLiq],[FlamCombustMaxSolid],[CorrosiveMaxLiq],[CorrosiveMaxSolid],[OxidizerMaxLiq],[OxidizerMaxSolid],[PeroxidesMaxLiq],[PeroxidesMaxSolid],[WaterReactiveMaxLiq],[WaterReactiveMaxSolid],[UnstableReactiveMaxLiq],[UnstableReactiveMaxSolid],[AcuteToxicMaxLiq],[AcuteToxicMaxSolid],[CRToxinsMaxLiq],[CRToxinsMaxSolid],[Isotopes],[InfectiousBio],[Power],[Other],[UpdateDate])"_
      & " VALUES ('" & BuildingName & "', '" & RoomID & "', '" & FloorNum & "', '" & RoomDesc & "', " & UMC & ", '"_
      & ContactName & "', '" & ContactUSUPhone & "','" & ContactHomePhone & "'," & ContactEmail & ",'" & AltContactName & "','"_
      & AltContactUSUPhone & "','" & AltContactHomePhone & "','" & FireExtLocation & "','" & MSDSInfoLocation & "','"_
      & NumFumeHoods & "','" & NumBioCabinets & "','" & FlamCombustMaxLiq & "','" & FlamCombustMaxSolid & "','" & CorrosiveMaxLiq & "','"_
      & CorrosiveMaxSolid & "','" & OxidizerMaxLiq & "','" & OxidizerMaxSolid & "','" & PeroxidesMaxLiq & "','" & PeroxidesMaxSolid & "','"_
      & WaterReactiveMaxLiq & "','" & WaterReactiveMaxSolid & "','" & UnstableReactiveMaxLiq & "','" & UnstableReactiveMaxSolid & "','"_
      & AcuteToxicMaxLiq & "','" & AcuteToxicMaxSolid & "','" & CRToxinsMaxLiq & "','" & CRToxinsMaxSolid & "','"_
      & Isotopes & "','" & InfectiousBio & "','" & Power & "','" & Other & "','" & UpdateDate & "')"

      oConn.Execute(sql)
0
jhmoen
Asked:
jhmoen
  • 4
  • 3
1 Solution
 
fritz_the_blankCommented:
Sure, do this:

response.write sql
response.end
oConn.Execute(sql)

That will write the result out on your page, and then you can copy and paste to test in your DBMS.

FtB
0
 
jhmoenAuthor Commented:
Okay,
I used this:
response.write sql
response.end

and the sql looks great.
The error i get is:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.


NO idea what I am missing.  All fields are putting in correct values in sql.  Is there a better way to test this?
0
 
fritz_the_blankCommented:
What database are you using?

FtB
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
fritz_the_blankCommented:
I am assuming from the message that you are using access. So, copy your sql, and then go to access, open a query in design view, choose the sql view, paste the query there and try to run it.

FtB
0
 
jhmoenAuthor Commented:
Bllllaaaahhhh,
Thanks guys!!!
It was my stinkin table!!!! Some field names were wrong.

All is well.
0
 
fritz_the_blankCommented:
I knew that it would be something like that. I always print out my sql and test it in the DBMS to make sure that I get what I think that I am going to.

FtB
0
 
jhmoenAuthor Commented:
Thanks .. Fritz the blank,

I have another update I can't seem to get.  I can't try it in access because it gets all of the inputs from a form.
I just posted it here: http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21410250.html

I can't get the concantenations ( I think thats what you call it) right.

Thanks,
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now