Problem with ADO and SQl Server on adding a new record in a table 
Author Message
 Problem with ADO and SQl Server on adding a new record in a table

Hi folks,
I have a problem with ADO 2.5 / ASP / SQL Server 7.0.
I have this table on my DB:

CREATE TABLE [dbo].[T_MESSAGGI] (
 [ID] [int] IDENTITY (1, 1) NOT NULL ,
 [NOME] [varchar] (20) NULL ,
 [COGNOME] [varchar] (30) NULL ,
 [ID_THREAD] [int] NOT NULL ,
 [DATA] [smalldatetime] NULL
) ON [PRIMARY]

I need to insert a new record in the database, and if the variable thread_id
is 0, i want set the field
[ID_THREAD]  equals to the [ID] of the same record.
With my code, at the end of a mail, sometime, ADO send me this error:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.

If I stop the code at the REM all work fine.

Thanks for any idea or suggestion and sorry for may bad english

--
Lorenzo Soncini
Delta Informatica S.p.a.

I have tried this code:
 dTimeStamp = Now()
 Set objRSInsert = Server.CreateObject("ADODB.RecordSet")
 objRSInsert.Open "T_MESSAGGI", cnnForumDC, adOpenDynamic,
adLockPessimistic,adCmdTable
 objRSInsert.AddNew
 objRSInsert.Fields("DATA") = dTimeStamp
 objRSInsert.Fields("NOME") = forum_id
 objRSInsert.Fields("COGNOME") = thread_id
 objRSInsert.Fields("ID_THREAD") = thread_id
objRSInsert.Update
REM ---
objRSInsert.Requery
 iNewMessageId = objRSInsert.Fields("ID")
 If thread_id = 0 Then
  objRSInsert.Update "ID_THREAD",iNewMessageId
 End If
REM ---
 objRSInsert.Close
 Set objRSInsert = Nothing



Sun, 02 Feb 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ADO and SQL Server error adding new record

2. Remote Data Control--Problems with Adding new Record to SQL Server 6.0 Database

3. Problem adding new record using SQL Server

4. Unable to add new record in sql table

5. Problem adding a new record with ADO

6. Problem adding new record to SQL database recordset

7. ADO and Datagrid Add new record problem ??

8. deleting records in a table and then adding new records

9. ADO2.5, can't add new record to an empty table using record binding

10. Problem seeking for records with ADO and SQL Server, Please Help

11. Problem seeking for records with ADO and SQL Server, Please Help

12. Problem seeking for records with ADO and SQL Server, Please Help

 

 
Powered by phpBB® Forum Software