Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: error message when i try to insert data to access table


Message #1 by Ales260@a... on Tue, 16 Apr 2002 12:43:57 EDT
hi,
 i am trying to insert data to my access table but each time i try i get thi
s
error message

microsoft OLE DB provider for ODBC driver (0x80040E4E)
operation was cancelled.
/respregister.asp, line 20

and here is the my code for respregister.asp

<%
newusername =3D TRIM( Request( "newusername" ) )
newpassword =3D TRIM( Request( "newpassword" ) )
email =3D TRIM( Request( "email" ) )
street =3D TRIM( Request( "street" ) )
city =3D TRIM( Request( "city" ) )
county =3D TRIM( Request( "county" ) )
postcode =3D TRIM( Request( "postcode" ) )


%>


=E2=80=98Open database connection



<%
Set Con =3D Server.CreateObject("ADODB.Connection")
Con.Open "padda"

sqlString =3D "INSERT INTO user( user_name, user_password, user_email,
user_street, user_city, user_county, user_postcode ) VALUES(' " & newusernam
e
& " ' , ' " & newpassword & " ', ' " & email & " ', ' " & street & " ', ' "=20
&
city & " ' , ' " & county & " ' , ' " & postcode & " ')"        
Con.Execute sqlString

%>

i am new to asp. can somebody please bail me out.
thanks
patrick
Message #2 by Abdul Sami <abdul_sami_20@y...> on Tue, 16 Apr 2002 09:59:55 -0700 (PDT)
one big mistake is
Con.Execute sqlString

it should be Con.Execute (sqlString)

You should also avoid extra spaces.

--- Ales260@a... wrote:
> hi,
>  i am trying to insert data to my access table but each time i try i get
> this 
> error message
> 
> microsoft OLE DB provider for ODBC driver (0x80040E4E)
> operation was cancelled.
> /respregister.asp, line 20
> 
> and here is the my code for respregister.asp
> 
> <%
> newusername = TRIM( Request( "newusername" ) )
> newpassword = TRIM( Request( "newpassword" ) )
> email = TRIM( Request( "email" ) )
> street = TRIM( Request( "street" ) )
> city = TRIM( Request( "city" ) )
> county = TRIM( Request( "county" ) )
> postcode = TRIM( Request( "postcode" ) )
> 
> 
> %>
> 
> 
> â??Open database connection
> 
> 
> 
> <%
> Set Con = Server.CreateObject("ADODB.Connection")
> Con.Open "padda"
> 
> sqlString = "INSERT INTO user( user_name, user_password, user_email, 
> user_street, user_city, user_county, user_postcode ) VALUES(' " &
> newusername 
> & " ' , ' " & newpassword & " ', ' " & email & " ', ' " & street & " ', '
> " & 
> city & " ' , ' " & county & " ' , ' " & postcode & " ')"         
> Con.Execute sqlString
>  
> %>
> 
> i am new to asp. can somebody please bail me out.
> thanks
> patrick
> 


=====
Abdul Sami

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
Message #3 by "Ken Schaefer" <ken@a...> on Fri, 19 Apr 2002 12:52:45 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Abdul Sami" <abdul_sami_20@y...>
Subject: [access_asp] Re: error message when i try to insert data to access
table


: one big mistake is
: Con.Execute sqlString
:
: it should be Con.Execute (sqlString)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is no "mistake". The end result is the same.

<% objConn.Execute strSQL %>
calls a subroutine passing strSQL ByRef

<% objConn.Execute(strSQL) %>
calls a subroutine passing strSQL ByVal, because it thinks that the ()
should be used to evaluate the expression in between the ( ).

This is why you can't call a subroutine passing multiple paramters *and*
also use ( ) because multiple parameters delimited by commas is not an
expression that can be evaluated. Instead, if you want to use ( ) to enclose
the paramter list you need to use the VB Call keyword:

<% Call objConn.Execute(strSQL, lngRecsAffected, adCmdText) %>

Cheers
Ken

Message #4 by "Ken Schaefer" <ken@a...> on Fri, 19 Apr 2002 12:55:10 +1000
Please see:

PRB: CancelUpdate After AddNew Causes Error If Datatype Is Invalid (Q257790)
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q257790

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <Ales260@a...>
Subject: [access_asp] error message when i try to insert data to access
table

hi,
 i am trying to insert data to my access table but each time i try i get
this
error message

microsoft OLE DB provider for ODBC driver (0x80040E4E)
operation was cancelled.
/respregister.asp, line 20

and here is the my code for respregister.asp

<%
newusername = TRIM( Request( "newusername" ) )
newpassword = TRIM( Request( "newpassword" ) )
email = TRIM( Request( "email" ) )
street = TRIM( Request( "street" ) )
city = TRIM( Request( "city" ) )
county = TRIM( Request( "county" ) )
postcode = TRIM( Request( "postcode" ) )

Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "padda"

sqlString = "INSERT INTO user( user_name, user_password, user_email,
user_street, user_city, user_county, user_postcode ) VALUES(' " &
newusername
& " ' , ' " & newpassword & " ', ' " & email & " ', ' " & street & " ', ' "
&
city & " ' , ' " & county & " ' , ' " & postcode & " ')"
Con.Execute sqlString
%>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index