Jump to content

Recommended Posts

Posted

ola pessoal,

tenho uma página já quase pronta...

consigo inserir, consultar e remover, importar tabelas...etc....

O meu problema está no actualizar:

tenho um form que me pede varios campos desde o código do cliente, nome, morada, etc...

eu através do código queria actualizar os dados:

tenho o seguinte código:

'Dimension variables

Dim adoCon 'Holds the Database Connection Object

Dim rsUpdateEntry 'Holds the recordset for the record to be updated

Dim strSQL 'Holds the SQL query for the database

Dim TXTCodigo 'Holds the record number to be updated

'Read in the record number to be updated

TXTCodigo = Request.Form("codigo")

'Create an ADO connection odject

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

'Set an active connection to the Connection object using a DSN-less connection

adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("bd1.mdb")

'Set an active connection to the Connection object using DSN connection

'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object

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

'Initialise the strSQL variable with an SQL statement to query the database

'strSQL = "SELECT * FROM tblCliente WHERE Cod-cliente=" & TXTCodigo

strSQL = "SELECT tblCliente.[Cod-cliente], tblCliente.Nome, tblCliente.Idade, tblCliente.Morada, tblCliente.Telemovel, tblCliente.Telefone, tblCliente.Profissao, tblCliente.Email FROM tblCliente WHERE (((tblCliente.[Cod-cliente])="& TXTCodigo& "))"

'Open the tblComments table using the SQL query held in the strSQL varaiable

rsUpdateEntry.Open strSQL, adoCon

'Update the record in the recordset

'rsUpdateEntry.Fields("Cod-cliente") = Request.Form("codigo")

rsUpdateEntry.Fields("Nome") = Request.Form("nome")

rsUpdateEntry.Fields("Idade") = Request.Form("idade")

rsUpdateEntry.Fields("Morada") = Request.Form("morada")

rsUpdateEntry.Fields("Telemovel") = Request.Form("telemovel")

rsUpdateEntry.Fields("Telefone") = Request.Form("telefone")

rsUpdateEntry.Fields("Profissao") = Request.Form("profissao")

rsUpdateEntry.Fields("Email") = Request.Form("email")

'Write the updated recordset to the database

rsUpdateEntry.Update

'Reset server objects

rsUpdateEntry.Close

Set rsUpdateEntry = Nothing

Set adoCon = Nothing

'Return to the update select page incase another record needs deleting

Response.write("bom")

%>

mas dá-me sempre este erro:

Tipo de erro:

ADODB.Recordset (0x800A0CB3)

O conjunto de registos actual não suporta actualização. Pode ser uma limitação do fornecedor ou do tipo de bloqueio seleccionado.

/Cópia de backup/update_entry.asp, linha 85

a linha 85 é:rsUpdateEntry.Fields("Nome") = Request.Form("nome")

é sempre que utilizo o rsUpdateEntry.Fields...

por favor alguém me ajude a resolver este erro...

obrigados...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.