|
-
Sep 7th, 2000, 07:39 AM
#1
Thread Starter
Addicted Member
Hi y'all - let me hear all da peeps in da house say Ho!
I'm attempting ton use asp's as a front end for my database, and I'm having dificulty inserting into a table. Can anyone tell me whats wrong with my code?
Cheers 'n' Beers
Skeen
<%
Dim cbSQL
Dim cnAcqAcc
Dim rsCName
Set cnAcqAcc = CreateObject ( "ADODB.Connection" )
cnAcqAcc.ConnectionString = "Provider=MSDASQL;DSN=AqAc;UID=AcqAcc_owner;PWD=AcqAcc_owner;"
cnAcqAcc.open
Custom_Name = Request.Form("T2")
cbSQL = "Insert Into Address_Details (Client_Nmae) values ('Custom_Name')"
Set rsCName = cnAcqAcc.Execute( cbSQL )
cnAcqAcc.Close
Set rsCatagory = Nothing
%>
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Sep 7th, 2000, 07:57 AM
#2
Hyperactive Member
There's a problem with sql statement.
cbSQL = "Insert Into Address_Details (Client_Nmae) values ('Custom_Name')"
Should be:
Code:
cbSQL = "Insert Into Address_Details (Client_Name) "
cbSQL = cbSQL & "values ('" & Custom_Name & "')"
-
Sep 7th, 2000, 04:44 PM
#3
Frenzied Member
While your at it:
Code:
Set rsCatagory = Nothing
should be:
Code:
Set rsCName = Nothing
And you are assigning a recordset to the .execute method of the connection object. This works great if you are calling a stored proc that does a select, but in this case, no recordset is returned so you will get an error.
If you want to read the recordset in to rsCName, you have to do it as a separate select statement.
/\/\onte96
-
Sep 8th, 2000, 08:42 AM
#4
Thread Starter
Addicted Member
Cheers Guys
Thanx,
worked just fine. NICE1
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|