Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: adding record to sql db via asp


Message #1 by "bilal" <bilalz@h...> on Wed, 3 Jul 2002 21:00:51
i'm trying to add a record to a sql database and getting all kinds of 
erros.
the following is the code ... i'd appreciate any help.
btw- the current error is: Arguments are of the wrong type, are out of 
acceptable range, or are in conflict with one another.
which points to the 6th line down in this snippet ...

'''''''''''''''''''''''''''''''''''
Dim objConnection, objRecordset
set objConnection = Server.CreateObject("ADODB.connection")
objConnection.Open "Driver={sql 
server};Server=Bilal;trusted_connection=yes;database=practice"
							
set objRecordset = Server.CreateObject( "ADODB.Recordset" )
objRecordset.Open "name_address", objConnection, adOpenKeyset, 
adLockOptimistic
								
objRecordset.AddNew
    objRecordset("fname") = Request.Form( "fname" )
    objRecordset("lname") = Request.Form( "lname" )
    objRecordset("add1") = Request.Form( "add1" )
    objRecordset("add2") = Request.Form( "add2" )
    objRecordset("city") = Request.Form( "city" )
    objRecordset("state") = Request.Form( "state" )
    objRecordset("zip") = Request.Form( "zip" )
objRecordset.Update

thanks
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 5 Jul 2002 13:26:29 +1000
www.adopenstatic.com/faq/800a0bb9.asp

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "bilal" <bilalz@h...>
Subject: [asp_database_setup] adding record to sql db via asp


: i'm trying to add a record to a sql database and getting all kinds of 
: erros.
: the following is the code ... i'd appreciate any help.
: btw- the current error is: Arguments are of the wrong type, are out of 
: acceptable range, or are in conflict with one another.
: which points to the 6th line down in this snippet ...
: 
: '''''''''''''''''''''''''''''''''''
: Dim objConnection, objRecordset
: set objConnection = Server.CreateObject("ADODB.connection")
: objConnection.Open "Driver={sql 
: server};Server=Bilal;trusted_connection=yes;database=practice"
: 
: set objRecordset = Server.CreateObject( "ADODB.Recordset" )
: objRecordset.Open "name_address", objConnection, adOpenKeyset, 
: adLockOptimistic
: 
: objRecordset.AddNew
:     objRecordset("fname") = Request.Form( "fname" )
:     objRecordset("lname") = Request.Form( "lname" )
:     objRecordset("add1") = Request.Form( "add1" )
:     objRecordset("add2") = Request.Form( "add2" )
:     objRecordset("city") = Request.Form( "city" )
:     objRecordset("state") = Request.Form( "state" )
:     objRecordset("zip") = Request.Form( "zip" )
: objRecordset.Update



  Return to Index