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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting into database using asp prob!!

Status
Not open for further replies.

tuam1234

Technical User
Feb 6, 2004
52
IE
Any help will be greatly appreciated.
i want to insert general information into a database. the problem is that when run, it goes into the if statement and displays the page choose.asp but the information from the form is not going into the database!!
any thoughts to why this is?????

Heres the code:

<%

'Dimension variables
Dim connection
Dim check
Dim data
Dim insert
Dim query


Set connection = Server.CreateObject(&quot;ADODB.Connection&quot;)

Call connection.Open(&quot;credit&quot;)

query = &quot;SELECT * FROM credInfo WHERE cardNum = '&quot; & _
CStr (Request (&quot;cardNum&quot;)) &&quot;'&quot;


Set data = Server.CreateObject(&quot;ADODB.RecordSet&quot;)

Call data.Open(query, connection)
On Error Resume Next

If data.EOF Then

insert = &quot;INSERT INTO credInfo VALUES ('&quot; & _
CStr (Request (&quot;name&quot;)) & &quot;','&quot; & _
CStr (Request (&quot;add1&quot;)) & &quot;','&quot; & _
CStr (Request (&quot;add2&quot;)) & &quot;','&quot; & _
CStr (Request (&quot;tele&quot;)) & &quot;','&quot; & _
CStr (Request (&quot;cardType&quot;)) & &quot;','&quot; & _
CStr (Request (&quot;cardNum&quot;)) & &quot;','&quot; & _
CStr (Request (&quot;exp&quot;)) & &quot;')&quot;

Call connection.Execute(insert)

Call data.Close()
Call connection.Close()
Call Response.Redirect(&quot;choose.asp&quot;)
Else
Call data.Close()
Call connection.Close()
Call Response.Redirect(&quot;incorrect.asp&quot;)
End If
%>
 
take this out :

On Error Resume Next

and you might get the error, it looks ok to me - but you might need to set permissions / check the sql

simon
 
try removing the word &quot;call&quot; from all of your statements. I've never used it in asp...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

 
thanks guys for replying, il try yer tips and let ye no!
 
mwolf00,

fyi
you can use 'Call' to call any sub or function, however if calling a function, no value is returned (obviously ;o)).



 
hey guys, iv tried what ye suggested and got

&quot;Error Type:
(0x800401F9)
Error in the DLL
/paycheck.asp, line 34&quot;

line 34 in code is:
connection.Open(&quot;credit&quot;)

i have connected it up properly in ODBC, giving the database the name credit.

any help??
 
this should be

connection.Open(&quot;credit&quot;,&quot;username&quot;,&quot;password&quot;)

then
 
hey simonchristieis, do u mean to include the columns of the table, ie

connection.Open(&quot;credit&quot;,&quot;name&quot;,&quot;add1&quot;,&quot;add2&quot;,&quot;tele&quot;,&quot;cardType&quot;,&quot;cardNum&quot;,&quot;exp&quot;).

if ya, well i tried id and got
&quot;Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/paycheck.asp, line 36, column 80
connection.Open(&quot;credit&quot;,&quot;name&quot;,&quot;add1&quot;,&quot;add2&quot;,&quot;tele&quot;,&quot;cardType&quot;,&quot;cardNum&quot;,&quot;exp&quot;)&quot;

if not, then excuse my ignorance!!
 
whats this dll?

Error in the DLL

are you using com?

remove the parentheses

connection.Open &quot;credit&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top