Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Statement

Status
Not open for further replies.

AdamVerellen

IS-IT--Management
Sep 20, 2002
39
CA
I have the following issue when trying to insert.

Set cnnSearch = Server.CreateObject("ADODB.Connection")

cnnSearch.Open "Provider=SQLOLEDB;Data Source=10.10.10.1;" _
& "Initial Catalog=TraceDB;User Id=sa;Password=;" _
& "Connect Timeout=15;Network Library=dbmssocn;"

strInsert = "Insert into
(dcreate, tcreate, Reason, Part, Qty) values ('" & date() & "','" & now() & "', 'Update','12345678',10 ;"

cnnSearch.Execute strInsert

Insert statement doesn't seem to want to work.
Did I miss anything, I figure maybe I am opening the database in Read Only or something?
 
have you tried to
Response.Write strInsert
Response.End

then paste the output to Analyzer yet


_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
just to add to that once you do it. that will give you the string value that actually hits the database. when you copy paste it to the analyzer you should rate away see the missing ) and there is no ; in SQL Server for statement termination

believe that is only Jet-SQL

_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
hehe oops :)
I might have more in a min
This was a slimed down version
 
I learned a valuable lesson in debugging
Thanks

It helps to do it
hehe
 
so it be fixed. I was expecting a twenty line query after the alst reply [wink]

glad it got you going

_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
With using the response write I figured the 20 line query out.
It ended up being something stupid, I'm sure as most errors are.

I'll put it in anyway.

left(spart,(instr(spart,"P")-1)) is where my error was
spart = 123456
it produced an error of course.
spart needs to have the P in it

But anyway, Thanks
 
[lol] @ the 20 line

That's the nice feature of SQL Server and using the Analyzer with debugging the statements. It's a slight irritation to do the same in whatever access calls that SQL Query thing. although it can be useful in the same way also.



_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top