Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

1sys

Erro na hora de inclusão do BD

Recommended Posts

olá galera eu funfando na web achei um script e quando fu testar deu o segunte erro:

 

Tipo de erro:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

[Microsoft][Driver ODBC para Microsoft Access] Não é possível atualizar. O banco de dados ou o objeto é somente leitura.

/v2.0 RC3a/counter/hit_count.asp, line 95

 

 

Tipo de navegador:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

 

Página:

GET /v2.0 RC3a/Default.asp

 

Sendo que qunado eu desabilito a linha 95 ( adoRec.Update) da o mesmo erro na linha 98 (adoRec.Requery)

 

Ai beleza funciona, mais quando coloco algo em algum campo para ser inserido do bd da erro como posso fazer para que este script funcione corretamente?

 

Segue o codigo

 

<%'Sub procedure for incrementing the hit counters'This is put in a Private Sub Prcedure so it does not interfere with other variables you may have in the script'This will stop errors and variables over writing each otherPrivate Sub IncrementHitCount(strAccessDBPath)	'Dimension Variables	Dim adoCon 		'Database Connection Variable	Dim strConH		'Holds the Database driver and the path and name of the database	Dim adoRec 		'Database Recordset Variable	Dim strAccessDB		'Holds the name a root to the Access Database	Dim strSQL 		'Database query sring	Dim lngTotalHitCount	'Holds the total visitor number	Dim lngResetHitCount	'Holds the visitor number since reset	Dim strPageName		'Holds the name of the page and the path to the page		'Error handler	'On error resume next			'Initialise the path to the access database		'strAccessDB = ""		'Read in the name and path to the page	'strPageName = Request.ServerVariables("SCRIPT_NAME")		strPageName = "default.asp"			 	'Create a connection odject	Set adoCon = Server.CreateObject("ADODB.Connection")		'------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below --------------				 	'Database connection info and driver (if this driver does not work then comment it out and use one of the alternative drivers)	'strConH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB)		'strConH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strAccessDB		'strConH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strEzDBPath2) '"../db/ez.mdb"		strConH = strCon	'Alternative drivers faster than the basic one above	'strConH = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath(strAccessDB) 'This one is if you convert the database to Access 97	'strConH = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(strAccessDB)  'This one is for Access 2000		'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers)	'strConH = "DSN=hitCountDB" 'Place the DSN name after the DSN=		'---------------------------------------------------------------------------------------------------------------------------------------------			'Set an active connection to the Connection object	adoCon.Open strConH			'Create a recordset object	Set adoRec = Server.CreateObject("ADODB.Recordset")						'Initalise the strSQL variable with an SQL statement to query the database to get the hit counts for the page	strSQL = "SELECT tblHitCount.* FROM tblHitCount "	strSQL = strSQL & " WHERE tblHitCount.Page ='" & strPagename & "';"			'Set the cursor type property of the record set to Keyset so we can navigate through the record set	adoRec.CursorType = 2		'Set the Lock Type for the records so that the record set is only locked when it is updated	adoRec.LockType = 3		'Open the recordset	adoRec.Open strSQL, strConH			'If there is no record relating to this page in the database then set the number of page hits to 1 and initilise a new record in the recordset	If adoRec.EOF Then			'Initilise the new values for the database		lngTotalHitCount = 1			  lngResetHitCount = 1					'Initilise a new record for the recordset		adoRec.AddNew					'Place the page name into the recordset		adoRec.Fields("Page") =  strPageName		'If there is a record relating to the page then read in the value from the recordset and increment	Else			'Read in the values form the database			lngTotalHitCount = CLng(adoRec("Total_Counter"))			  lngResetHitCount = CLng(adoRec("Reset_Counter"))			  			  'Increment the hit counters			  lngTotalHitCount = lngTotalHitCount + 1			  lngResetHitCount = lngResetHitCount + 1	End If  	  	'Place the vlues into the recordset	adoRec.Fields("Total_Counter") =  lngTotalHitCount 	adoRec.Fields("Reset_Counter") =  lngResetHitCount 							'Place the updated recordset into the database	adoRec.Update		'Requery the database	adoRec.Requery	 		'Close Server Objects 	Set adoCon = Nothing	Set adoRec = NothingEnd Sub%>
Fico aguardando contatos

Compartilhar este post


Link para o post
Compartilhar em outros sites

olá lucasBR, verifiquei e fiz tudo como você falou sendo q continua a mesma coisasera q e o q?

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.