12020.html
来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 27 行
HTML
27 行
<html>
<head>
<title>Try this way</title>
</head>
<body bgcolor="#FFFFFF" vlink="#808080">
<center>
<h1>Try this way</h1>
</center>
<hr size=7 width=75%>
<hr size=7 width=75%><p>
Posted by RamyJones on April 15, 1999 at 11:39:36:<p>
In Reply to: <a href="12006.html">ADO Command物件所开启的Recordset只能ReadOnly?</a> posted by cww on April 15, 1999 at 08:23:08:<p>
Assume we declare the following object variable:<p>Dim Con1 as ADODB.Connection<br>Dim Cmd1 as ADODB.Command<br>Dim Rs1 as ADODB.Recordset<p>you could try this way to open an updatable recordset:<p> Set Con1 = New ADODB.Connection<br> Set Cmd1 = New ADODB.Command<br> Set Rs1 = New ADODB.Recordset<br> <br> Con1.ConnectionString = "DSN=Employee"<br> Con1.Open<p> Cmd1.ActiveConnection = Con1<br> Cmd1.CommandText = "SELECT * FROM MasterTable;"<br> <br> Rs1.Open Cmd1, , adOpenDynamic, adLockOptimistic<br> <p>while you want a transaction, then use the following :<p> <br> Rs1.Update "Name", Text1.Text '<<< anyway, or something else string you like !<p><br>It's working well in my program, and I think that your trouble goes to the missing of <br>changing the locktype.<p>If you don't implement the locktype explicitly, the default locktype of Microsoft ADO 2.0 <br>recordset object is Read-Only.<p>Even though I don't use SQL7.0, anyway, I think it still working. May you have a nice work.<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 12020-->
<!--top: 12027--><li><a href="12027.html">太好了!!! :)</a> <b>cww</b> <i>15:20:10 4/15/99</i>
(<!--responses: 12027-->0)
<ul><!--insert: 12027-->
</ul><!--end: 12027-->
</ul><!--end: 12020-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?