Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Add Records


Message #1 by "Rick Agrella" <ricka@m...> on Sat, 20 Oct 2001 20:48:21
I am getting an error that says



Error Type:

ADODB.Recordset (0x800A0CB3)

Object or provider is not capable of performing requested operation.

/db/NewUser.asp, line 29



Here is my code:



<% 

	

	strUserName = Request.QueryString("UName")

	strPassword = Request.QueryString("PWord")

	strFirstName = Request.QueryString("FName")

	strLastName = Request.QueryString("LName")

	strEmail = Request.QueryString("EMail")

	strGender = Request.QueryString("Gender")

	strAge = Request.QueryString("Age")



	Dim adOpenForwardOnly, adLockReadOnly, adCmdTable

	adOpenForwardOnly = 0

	adLockReadOnly = 1

	adCmdTable = 2



	Dim objConn, objRS, objCommand

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

	Set objRS = Server.CreateObject("ADODB.Recordset")



	objConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Persist Security 

Info=False;" & _

		       "Data Source = c:\Inetpub\wwwroot\DB\subscribe.mdb"



	

	objRS.ActiveConnection = objConn

	objRS.CursorType = adOpenKeyset

	'objRS.LockType = adLockBatchOptimistic



	objRS.Open "Subscribe",,,,adCmdTable

	objRS.AddNew

	objRS("UserName") = strUserName

	objRS("Password") = strPassword

	objRS("FirstName") = strFirstName

	objRS("LastName") = strLastName

	objRS("Email") = strEmail

	objRS("Gender") = strGender

	objRS("Age") = strAge

	objRS.Updatebatch



	objRS.Close

	objConn.Close

	Set objRS = Nothing

	Set objConn = Nothing



%>
Message #2 by "Ethan Selzer" <ethanselzer@m...> on Sat, 20 Oct 2001 15:27:35 -0700
Hi Rick



Just on cursory glance I don't see that you have defined the ADO constants

adOpenKeyset and adLockBatchOptimistic.



Try:

adLockBatchOptimistic = 4



Const adOpenKeyset = 1



Another note adLockBatchOptimistic is typically used to update multiple

records.  Usually adLockPessimistic or adLockOptimistic is used when only

one record is being changed.



Ethan





-----Original Message-----

From: Rick Agrella [mailto:ricka@m...]

Sent: Saturday, October 20, 2001 8:48 PM

To: Access ASP

Subject: [access_asp] Add Records



I am getting an error that says



Error Type:

ADODB.Recordset (0x800A0CB3)

Object or provider is not capable of performing requested operation.

/db/NewUser.asp, line 29



Here is my code:



<%



        strUserName = Request.QueryString("UName")

        strPassword = Request.QueryString("PWord")

        strFirstName = Request.QueryString("FName")

        strLastName = Request.QueryString("LName")

        strEmail = Request.QueryString("EMail")

        strGender = Request.QueryString("Gender")

        strAge = Request.QueryString("Age")



        Dim adOpenForwardOnly, adLockReadOnly, adCmdTable

        adOpenForwardOnly = 0

        adLockReadOnly = 1

        adCmdTable = 2



        Dim objConn, objRS, objCommand

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

        Set objRS = Server.CreateObject("ADODB.Recordset")



        objConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Persist Security

Info=False;" & _

                       "Data Source = c:\Inetpub\wwwroot\DB\subscribe.mdb"





        objRS.ActiveConnection = objConn

        objRS.CursorType = adOpenKeyset

        'objRS.LockType = adLockBatchOptimistic



        objRS.Open "Subscribe",,,,adCmdTable

        objRS.AddNew

        objRS("UserName") = strUserName

        objRS("Password") = strPassword

        objRS("FirstName") = strFirstName

        objRS("LastName") = strLastName

        objRS("Email") = strEmail

        objRS("Gender") = strGender

        objRS("Age") = strAge

        objRS.Updatebatch



        objRS.Close

        objConn.Close

        Set objRS = Nothing

        Set objConn = Nothing



%>






  Return to Index