ADO与access?????????????????????????????????????????????????????????????? 用CANCELUPDATE应该可以恢复,或是利用事件来进行恢复 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 程序上有什么问题啊!?我是将TEXT控件帮定到数据库的阿!能不能说的详细一点? 绑定还用什么 Update呀,用绑定的方法,Addnew了之后,只要结果集指针移动了就相当于Update了!! 就是啊!我就是因为这个问题而头痛啊!如果不帮定的阿,那要怎么做阿!?就是因为ADD.NEW后,我移动指针,那条数据就自动加进去啦。那样很麻烦啊!有没有好的方法啊? 不要绑定,直接把数据库的东西拿到text去,要修改、新增都用代码完成如;rs.addnewrs("studentname")=text1.text......rs.update 我建议你不要用任何绑定的方法,这样虽然开发快了,但你不会学到任何有价值的东西,要成为高手只有自己动手。而且绑定控件经常会产生一些莫明其妙的问题,限制多多,享受不到控制程序的乐趣。基本思想:在FlexGrid中输入数据,新添的数据在第一列加一个标识符“!”,修改的数据在第一列加一个标识符“*”。在生成SQL语句时,通过检查这些标识进行相应的生成。要养成尽量用SQL语句实现数据库操作的习惯,因为用RecordSet方法,有很多意外出现,特别是在多用户数据库开发时。记住,这绝对是经验之谈。Dim I As Integer, J As IntegerDim strTemp As String, varField As Variant, strInsert As String, strUpdate As StringDim strRJGZ As String, strJD As String Screen.MousePointer = vbHourglass If CG_opt_XZ(0) Then strJD = "0" Else strJD = "1" varField = Array("", "bzmc", "ygbh", "ygxm", "gwgz", "nggz", "zjjt", "wsf", "qt", "bxf", "ybf", "bzid", "gjmc", "rjgz", "jd") strInsert = "": strUpdate = "": strSQL = "" With CG_hfg_Main For I = 1 To .Rows - 1 .Col = 1 If .TextMatrix(I, 0) = "!" Then strTemp = "" strInsert = strInsert & " insert into gzjbb (" For J = 1 To UBound(varField) strTemp = strTemp & varField(J) & "," Next strTemp = Left(strTemp, Len(strTemp) - 1) strInsert = strInsert & strTemp & ") values (" strTemp = "" For J = 1 To .Cols - 1 strTemp = strTemp & " '" & .TextMatrix(I, J) & "'," Next strRJGZ = Format((CSng(.TextMatrix(I, 4)) + CSng(.TextMatrix(I, 5))) / CSng(strGZR), "#####0.00")' strTemp = Left(strTemp, Len(strTemp) - 1) strInsert = strInsert & strTemp & " '" & strRJGZ & "','" & strJD & "')" ElseIf InStr(.TextMatrix(I, 0), "*") > 0 Then strTemp = "" For J = 1 To .Cols - 1 strTemp = strTemp & varField(J) & " = '" & .TextMatrix(I, J) & "'," Next strRJGZ = Format((CSng(.TextMatrix(I, 4)) + CSng(.TextMatrix(I, 5))) / CSng(strGZR), "#####0.00") strTemp = strTemp & "RJGZ = '" & strRJGZ & "'" & ",JD='" & strJD & "'" .TextMatrix(I, 0) = Right(.TextMatrix(I, 0), Len(.TextMatrix(I, 0)) - 1) strUpdate = strUpdate & "update gzjbb set " & strTemp & " where id = '" & .TextMatrix(I, 0) & "'" End If Next End With If strInsert <> "" Then adoGZGL.Execute strInsert, , adCmdText If strUpdate <> "" Then adoGZGL.Execute strUpdate, , adCmdText 大家能不能推荐一些好的ado的书或者网站啊!最好有源码的。 你要例子吗?给出EMAIL我可以发个给你(完整access+ado)!不过得,呵呵~~ ok!thank you ![email protected] siyuan79(荔枝):可在WillChangeField、RecordChangeComplete这两个事件进行判断!具体我也不是很记得了!我不是广州移动的,但我和广州移动很多人熟!你怎么会在里面看到我的名字呢?我的真名你知吗?!呵呵~~ 请教一个基础问题。。。。。 怎样阻止IP地址被浏览器检测去并交到远程数据库? 非典型肺炎的治疗与预防 关于DLL调用的一个问题(不好意思,以前的不知道是不是发错地方了) 谁有一下网站的帐号! 怎样让win98定时起动一个vb程序亚? 如何知道机器的空闲时间? 关于DTPicker的问题,求指点 学了三年的数据库,怎么对这个问题一点思路也没有 word vba插入文件录制显示xlicons.exe怎么获取这个文件路径? 数据提交的问题~~ 请问怎样用api函数编写多媒体应用程序?
能不能说的详细一点?
就是因为ADD.NEW后,我移动指针,那条数据就自动加进去啦。那样很麻烦啊!有没有好的方法啊?
如;
rs.addnew
rs("studentname")=text1.text
......
rs.update
成为高手只有自己动手。而且绑定控件经常会产生一些莫明其妙的问题,限制多多,享受不
到控制程序的乐趣。
基本思想:在FlexGrid中输入数据,新添的数据在第一列加一个标识符“!”,修改的数据
在第一列加一个标识符“*”。在生成SQL语句时,通过检查这些标识进行相应的生成。要养
成尽量用SQL语句实现数据库操作的习惯,因为用RecordSet方法,有很多意外出现,特别是
在多用户数据库开发时。记住,这绝对是经验之谈。
Dim I As Integer, J As Integer
Dim strTemp As String, varField As Variant, strInsert As String, strUpdate As String
Dim strRJGZ As String, strJD As String
Screen.MousePointer = vbHourglass
If CG_opt_XZ(0) Then strJD = "0" Else strJD = "1"
varField = Array("", "bzmc", "ygbh", "ygxm", "gwgz", "nggz", "zjjt", "wsf", "qt", "bxf", "ybf", "bzid", "gjmc", "rjgz", "jd")
strInsert = "": strUpdate = "": strSQL = ""
With CG_hfg_Main
For I = 1 To .Rows - 1
.Col = 1
If .TextMatrix(I, 0) = "!" Then
strTemp = ""
strInsert = strInsert & " insert into gzjbb ("
For J = 1 To UBound(varField)
strTemp = strTemp & varField(J) & ","
Next
strTemp = Left(strTemp, Len(strTemp) - 1)
strInsert = strInsert & strTemp & ") values ("
strTemp = ""
For J = 1 To .Cols - 1
strTemp = strTemp & " '" & .TextMatrix(I, J) & "',"
Next
strRJGZ = Format((CSng(.TextMatrix(I, 4)) + CSng(.TextMatrix(I, 5))) / CSng(strGZR), "#####0.00")
' strTemp = Left(strTemp, Len(strTemp) - 1)
strInsert = strInsert & strTemp & " '" & strRJGZ & "','" & strJD & "')"
ElseIf InStr(.TextMatrix(I, 0), "*") > 0 Then
strTemp = ""
For J = 1 To .Cols - 1
strTemp = strTemp & varField(J) & " = '" & .TextMatrix(I, J) & "',"
Next
strRJGZ = Format((CSng(.TextMatrix(I, 4)) + CSng(.TextMatrix(I, 5))) / CSng(strGZR), "#####0.00")
strTemp = strTemp & "RJGZ = '" & strRJGZ & "'" & ",JD='" & strJD & "'"
.TextMatrix(I, 0) = Right(.TextMatrix(I, 0), Len(.TextMatrix(I, 0)) - 1)
strUpdate = strUpdate & "update gzjbb set " & strTemp & " where id = '" & .TextMatrix(I, 0) & "'"
End If
Next
End With
If strInsert <> "" Then adoGZGL.Execute strInsert, , adCmdText
If strUpdate <> "" Then adoGZGL.Execute strUpdate, , adCmdText
thank you !
[email protected]
可在WillChangeField、RecordChangeComplete这两个事件进行判断!具体我也不是很记得了!
我不是广州移动的,但我和广州移动很多人熟!你怎么会在里面看到我的名字呢?我的真名你知吗?!呵呵~~