# Try this way

Posted by RamyJones on April 15, 1999 at 11:39:36:

In Reply to: ADO Command物件所开启的Recordset只能ReadOnly? posted by cww on April 15, 1999 at 08:23:08:

Assume we declare the following object variable:

Dim Con1 as ADODB.Connection
Dim Cmd1 as ADODB.Command
Dim Rs1 as ADODB.Recordset

you could try this way to open an updatable recordset:

Set Con1 = New ADODB.Connection
Set Cmd1 = New ADODB.Command
Set Rs1 = New ADODB.Recordset
Con1.ConnectionString = "DSN=Employee"
Con1.Open

Cmd1.ActiveConnection = Con1
Cmd1.CommandText = "SELECT * FROM MasterTable;"
Rs1.Open Cmd1, , adOpenDynamic, adLockOptimistic

while you want a transaction, then use the following :

Rs1.Update "Name", Text1.Text '<<< anyway, or something else string you like !

It's working well in my program, and I think that your trouble goes to the missing of
changing the locktype.

If you don't implement the locktype explicitly, the default locktype of Microsoft ADO 2.0
recordset object is Read-Only.

Even though I don't use SQL7.0, anyway, I think it still working. May you have a nice work.

Follow Ups:

- 太好了!!! :) cww 15:20:10 4/15/99 (0)