Ado Save & Open with SQL server 7.0 
Author Message
 Ado Save & Open with SQL server 7.0

Hello,

The recordset update doesnot work after a save and open for me ???
For save, everything works well, I check the modified value in the XML
file.
For Open, the modified value is in the recordset when this one is
openned. However, the update does not report the modification in the
database.
I am using ado 2.5 and MSDE is from Office 2000 on Window NT 4.0, SP 5.
Here is my code.
Thanks for your help
Lan

For Recordset.Save :
    Set conn = New ADODB.Connection
    conn.ConnectionString
= "Provider=SQLOLEDB;server=GEN9;Trusted_Connection=yes;database=myDB"
    conn.connect
    Set rec = New ADODB.Recordset
    rec.CursorLocation = adUseClient
    rec.Open "SELECT * From myTab",conn,adOpenStatic,adLockOptimistic,
adCmdText
    Set rec.ActiveConnection = Nothing
    rec.Fields(1) = "abcd"
    rec.Save App.Path & "\myFile", adPersistXML
    rec.Close:Set rec = Nothing
    conn.Close: Set conn = Nothing

For Recordset.Open and update:
    Set conn = New ADODB.Connection ....
    Set rec = New ADODB.Recordset
    rec.Open App.Path & "\myFile",,adOpenStatic,adLockOptimistic,
adCmdFile
    Set rec.ActiveConnection = conn
    rec.Update
    rec.Close:Set rec = Nothing
    conn.Close: Set conn = Nothing

Sent via Deja.com
http://www.*-*-*.com/



Mon, 02 Jun 2003 22:53:18 GMT  
 Ado Save & Open with SQL server 7.0
Try to use adLockBatchOptimistic instead of adLockOptimistic.

G. Chen


Quote:
> Hello,

> The recordset update doesnot work after a save and open for me ???
> For save, everything works well, I check the modified value in the XML
> file.
> For Open, the modified value is in the recordset when this one is
> openned. However, the update does not report the modification in the
> database.
> I am using ado 2.5 and MSDE is from Office 2000 on Window NT 4.0, SP 5.
> Here is my code.
> Thanks for your help
> Lan

> For Recordset.Save :
>     Set conn = New ADODB.Connection
>     conn.ConnectionString
> = "Provider=SQLOLEDB;server=GEN9;Trusted_Connection=yes;database=myDB"
>     conn.connect
>     Set rec = New ADODB.Recordset
>     rec.CursorLocation = adUseClient
>     rec.Open "SELECT * From myTab",conn,adOpenStatic,adLockOptimistic,
> adCmdText
>     Set rec.ActiveConnection = Nothing
>     rec.Fields(1) = "abcd"
>     rec.Save App.Path & "\myFile", adPersistXML
>     rec.Close:Set rec = Nothing
>     conn.Close: Set conn = Nothing

> For Recordset.Open and update:
>     Set conn = New ADODB.Connection ....
>     Set rec = New ADODB.Recordset
>     rec.Open App.Path & "\myFile",,adOpenStatic,adLockOptimistic,
> adCmdFile
>     Set rec.ActiveConnection = conn
>     rec.Update
>     rec.Close:Set rec = Nothing
>     conn.Close: Set conn = Nothing

> Sent via Deja.com
> http://www.deja.com/



Fri, 06 Jun 2003 14:49:43 GMT  
 Ado Save & Open with SQL server 7.0
Chen,
Thanks for your advice.

However, the attempt with adLockBatchOptimistic does not solve my
problem.
I am sure that Save is ok, since in the XML file I see the modification
as :
<rs:data>
        <rs:update>
                <rs:original>
                        <z:row BASE_ID='XYZ' BASE_NAM='TOTO'/>
                </rs:original>
                <z:row BASE_NAM='abcd'/>
        </rs:update>

And when I open this file, I can see that the record field is 'abcd' as
expected.
But the update to the original database does not work !!!
So, what is wrong ?
Lan



Quote:
> Try to use adLockBatchOptimistic instead of adLockOptimistic.

> G. Chen



> > Hello,

> > The recordset update doesnot work after a save and open for me ???
> > For save, everything works well, I check the modified value in the
XML
> > file.
> > For Open, the modified value is in the recordset when this one is
> > openned. However, the update does not report the modification in the
> > database.
> > I am using ado 2.5 and MSDE is from Office 2000 on Window NT 4.0,
SP 5.
> > Here is my code.
> > Thanks for your help
> > Lan

> > For Recordset.Save :
> >     Set conn = New ADODB.Connection
> >     conn.ConnectionString

= "Provider=SQLOLEDB;server=GEN9;Trusted_Connection=yes;database=myDB"
Quote:
> >     conn.connect
> >     Set rec = New ADODB.Recordset
> >     rec.CursorLocation = adUseClient
> >     rec.Open "SELECT * From

myTab",conn,adOpenStatic,adLockOptimistic,

- Show quoted text -

Quote:
> > adCmdText
> >     Set rec.ActiveConnection = Nothing
> >     rec.Fields(1) = "abcd"
> >     rec.Save App.Path & "\myFile", adPersistXML
> >     rec.Close:Set rec = Nothing
> >     conn.Close: Set conn = Nothing

> > For Recordset.Open and update:
> >     Set conn = New ADODB.Connection ....
> >     Set rec = New ADODB.Recordset
> >     rec.Open App.Path & "\myFile",,adOpenStatic,adLockOptimistic,
> > adCmdFile
> >     Set rec.ActiveConnection = conn
> >     rec.Update
> >     rec.Close:Set rec = Nothing
> >     conn.Close: Set conn = Nothing

> > Sent via Deja.com
> > http://www.deja.com/

Sent via Deja.com
http://www.deja.com/


Sat, 07 Jun 2003 22:29:14 GMT  
 Ado Save & Open with SQL server 7.0
Did you use UpdateBatch ?
I have some codes work in the same way, it fine.

G. Chen


Quote:
> Chen,
> Thanks for your advice.

> However, the attempt with adLockBatchOptimistic does not solve my
> problem.
> I am sure that Save is ok, since in the XML file I see the modification
> as :
> <rs:data>
> <rs:update>
> <rs:original>
> <z:row BASE_ID='XYZ' BASE_NAM='TOTO'/>
> </rs:original>
> <z:row BASE_NAM='abcd'/>
> </rs:update>

> And when I open this file, I can see that the record field is 'abcd' as
> expected.
> But the update to the original database does not work !!!
> So, what is wrong ?
> Lan



> > Try to use adLockBatchOptimistic instead of adLockOptimistic.

> > G. Chen



> > > Hello,

> > > The recordset update doesnot work after a save and open for me ???
> > > For save, everything works well, I check the modified value in the
> XML
> > > file.
> > > For Open, the modified value is in the recordset when this one is
> > > openned. However, the update does not report the modification in the
> > > database.
> > > I am using ado 2.5 and MSDE is from Office 2000 on Window NT 4.0,
> SP 5.
> > > Here is my code.
> > > Thanks for your help
> > > Lan

> > > For Recordset.Save :
> > >     Set conn = New ADODB.Connection
> > >     conn.ConnectionString

> = "Provider=SQLOLEDB;server=GEN9;Trusted_Connection=yes;database=myDB"
> > >     conn.connect
> > >     Set rec = New ADODB.Recordset
> > >     rec.CursorLocation = adUseClient
> > >     rec.Open "SELECT * From
> myTab",conn,adOpenStatic,adLockOptimistic,
> > > adCmdText
> > >     Set rec.ActiveConnection = Nothing
> > >     rec.Fields(1) = "abcd"
> > >     rec.Save App.Path & "\myFile", adPersistXML
> > >     rec.Close:Set rec = Nothing
> > >     conn.Close: Set conn = Nothing

> > > For Recordset.Open and update:
> > >     Set conn = New ADODB.Connection ....
> > >     Set rec = New ADODB.Recordset
> > >     rec.Open App.Path & "\myFile",,adOpenStatic,adLockOptimistic,
> > > adCmdFile
> > >     Set rec.ActiveConnection = conn
> > >     rec.Update
> > >     rec.Close:Set rec = Nothing
> > >     conn.Close: Set conn = Nothing

> > > Sent via Deja.com
> > > http://www.deja.com/

> Sent via Deja.com
> http://www.deja.com/



Sun, 08 Jun 2003 11:00:49 GMT  
 Ado Save & Open with SQL server 7.0
OK, it works with UpdateBatch
Chen, many thanks.
Lan


Quote:
> Did you use UpdateBatch ?
> I have some codes work in the same way, it fine.

> G. Chen



> > Chen,
> > Thanks for your advice.

> > However, the attempt with adLockBatchOptimistic does not solve my
> > problem.
> > I am sure that Save is ok, since in the XML file I see the
modification
> > as :
> > <rs:data>
> > <rs:update>
> > <rs:original>
> > <z:row BASE_ID='XYZ' BASE_NAM='TOTO'/>
> > </rs:original>
> > <z:row BASE_NAM='abcd'/>
> > </rs:update>

> > And when I open this file, I can see that the record field
is 'abcd' as
> > expected.
> > But the update to the original database does not work !!!
> > So, what is wrong ?
> > Lan



> > > Try to use adLockBatchOptimistic instead of adLockOptimistic.

> > > G. Chen



> > > > Hello,

> > > > The recordset update doesnot work after a save and open for
me ???
> > > > For save, everything works well, I check the modified value in
the
> > XML
> > > > file.
> > > > For Open, the modified value is in the recordset when this one
is
> > > > openned. However, the update does not report the modification
in the
> > > > database.
> > > > I am using ado 2.5 and MSDE is from Office 2000 on Window NT
4.0,
> > SP 5.
> > > > Here is my code.
> > > > Thanks for your help
> > > > Lan

> > > > For Recordset.Save :
> > > >     Set conn = New ADODB.Connection
> > > >     conn.ConnectionString

= "Provider=SQLOLEDB;server=GEN9;Trusted_Connection=yes;database=myDB"

- Show quoted text -

Quote:
> > > >     conn.connect
> > > >     Set rec = New ADODB.Recordset
> > > >     rec.CursorLocation = adUseClient
> > > >     rec.Open "SELECT * From
> > myTab",conn,adOpenStatic,adLockOptimistic,
> > > > adCmdText
> > > >     Set rec.ActiveConnection = Nothing
> > > >     rec.Fields(1) = "abcd"
> > > >     rec.Save App.Path & "\myFile", adPersistXML
> > > >     rec.Close:Set rec = Nothing
> > > >     conn.Close: Set conn = Nothing

> > > > For Recordset.Open and update:
> > > >     Set conn = New ADODB.Connection ....
> > > >     Set rec = New ADODB.Recordset
> > > >     rec.Open App.Path

& "\myFile",,adOpenStatic,adLockOptimistic,

- Show quoted text -

Quote:
> > > > adCmdFile
> > > >     Set rec.ActiveConnection = conn
> > > >     rec.Update
> > > >     rec.Close:Set rec = Nothing
> > > >     conn.Close: Set conn = Nothing

> > > > Sent via Deja.com
> > > > http://www.deja.com/

> > Sent via Deja.com
> > http://www.deja.com/

Sent via Deja.com
http://www.deja.com/


Sun, 08 Jun 2003 21:46:28 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Need to Save .rpt files in SQL Server 7.0 with ADO 2.1

2. SQL Server 7.0 , ADO & VB 6.0

3. How to open an upsized SQL Server 7.0 Database through VB6

4. ado connection to SQL Server 7.0

5. MS SQL Server 7.0 & VB distribution

6. Problem refreshing SQL Server 7.0 joins in ADO

7. ado SP problem in SQL Server 7.0 and 2000

8. SQL Server 7.0 and ADO Cursors

9. ADODC & Detach in SQL server 7.0

10. ADO and SQL Server 7.0

11. Boolean (SQL Server 7.0 & VB 6.0)

12. ADO vs ODBC (SQL Server 7.0)

 

 
Powered by phpBB® Forum Software