求高人指点...VB转delphi的.哭一天了.
时间:2011-11-15
来源:互联网
新手刚学了俩月delphi,接触了个vb转delphi的代码:
Public Function ExeRecordset(ByVal sql As String, m_con As ADODB.Connection, Optional nCursorLocation As CursorLocationEnum = adUseClient, Optional nCursorType As CursorTypeEnum = adOpenDynamic, Optional nLockType As LockTypeEnum = adLockOptimistic) As ADODB.Recordset
Dim mRs As ADODB.Recordset
Set mRs = New ADODB.Recordset
mRs.CursorLocation = nCursorLocation
mRs.Open sql, m_con, nCursorType, nLockType
Set ExeRecordset = mRs
End Function
真心求教,这段运行查询,返回记录集的代码.定义中的Optional nCursorLocation As CursorLocationEnum = adUseClient, Optional nCursorType As CursorTypeEnum = adOpenDynamic, Optional nLockType As LockTypeEnum = adLockOptimistic 这一段我不知道在delphi中该怎么写,作为可选返回参数来说这些有写的必要吗?
还有这些,我不太理解函数名(GetDictory)套进函数本身是的做法.为什么不用(SourceDictory),虚心求教,在VB区发的没人理...
Private Function GetDictory(SourceDictory As String) As String
GetDictory = Mid(SourceDictory, 1, Len(SourceDictory) - 1)
Do While InStr(1, GetDictory, "\") <> 0
GetDictory = Mid(GetDictory, InStr(1, GetDictory, "\") + 1)
Loop
End Function
Public Function ExeRecordset(ByVal sql As String, m_con As ADODB.Connection, Optional nCursorLocation As CursorLocationEnum = adUseClient, Optional nCursorType As CursorTypeEnum = adOpenDynamic, Optional nLockType As LockTypeEnum = adLockOptimistic) As ADODB.Recordset
Dim mRs As ADODB.Recordset
Set mRs = New ADODB.Recordset
mRs.CursorLocation = nCursorLocation
mRs.Open sql, m_con, nCursorType, nLockType
Set ExeRecordset = mRs
End Function
真心求教,这段运行查询,返回记录集的代码.定义中的Optional nCursorLocation As CursorLocationEnum = adUseClient, Optional nCursorType As CursorTypeEnum = adOpenDynamic, Optional nLockType As LockTypeEnum = adLockOptimistic 这一段我不知道在delphi中该怎么写,作为可选返回参数来说这些有写的必要吗?
还有这些,我不太理解函数名(GetDictory)套进函数本身是的做法.为什么不用(SourceDictory),虚心求教,在VB区发的没人理...
Private Function GetDictory(SourceDictory As String) As String
GetDictory = Mid(SourceDictory, 1, Len(SourceDictory) - 1)
Do While InStr(1, GetDictory, "\") <> 0
GetDictory = Mid(GetDictory, InStr(1, GetDictory, "\") + 1)
Loop
End Function
作者: whosseven 发布时间: 2011-11-15
看上面代碼,在DELPHI是數據庫編程的入門級。如果VB熟悉的話,就先找本DELPHI的數據庫入門看看。如果VB也不熟,那就別轉了。
作者: Oraclers 发布时间: 2011-11-15
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28