General information
Category:
Database DAO/RDO/ODBC/ADO
>hi all,
>
>i have a problem with deleting a record, it won't update my data provider.
>i use sql server as a data provider and datashape to relate my one to many relationship accessed through ado. here's my code.
>
>Dim ShapeConn as ADODB.Connection
>Dim HeaderRs as ADODB.Recordset, DetailRs as ADODB.Recordset
>
> Set ShapeConn = New ADODB.Connection
> Strconn = "Provider=MSDataShape;Data Provider=SQLOLEDB;" _
> & "Server=Jeffrey;UID=sa;Database=Personnel"
> ShapeConn.Open Strconn
>
> Set HeaderRs = New ADODB.Recordset
> HeaderRs.Open "SHAPE {SELECT * FROM header} " _
> & "APPEND ({SELECT * FROM detail} " _
> & "RELATE DocnNum TO DocnNUm) AS RsParent", ShapeConn, adOpenKeyset, adLockBatchOptimistic
> Set Detail = ActiveRs("RsParent").Value
>
>
>Private Sub CmdDelete_Click()
> HeaderRs.Delete
>End Sub
>
>I have also a delete trigger in my header table. here's the code
>
>CREATE TRIGGER DelCascade ON [Header]
>FOR DELETE
>AS
> DECLARE @document varchar(16)
> SELECT @document = DocnNum FROM deleted
> DELETE detail WHERE detail.DocnNum = @Document
>
>Thanks for the help
Hi,
I don't know if this will fix the problem, but my first thought was that the line:
Set Detail = ActiveRs("RsParent").Value
should be:
Set DetailRs = ActiveRs("RsParent").Value
Pete
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only