Ado Save & Open with SQL server 7.0
Author |
Message |
le_lan_hu.. #1 / 5
|
 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 |
|
 |
G. Che #2 / 5
|
 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 |
|
 |
le_lan_hu.. #3 / 5
|
 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, 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 |
|
 |
G. Che #4 / 5
|
 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 |
|
 |
le_lan_hu.. #5 / 5
|
 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" 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, 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 |
|
|
|