Public Function GetValue(ByVal sqlstr As String) As adodb.Recordset
Dim Rs As adodb.Recordset
Conn.GetRecordset ConnStr, sqlstr, Rs
Set GetValue = Rs
End Function
提示user-defined type not defined
谢谢了!
Dim Rs As adodb.Recordset
Conn.GetRecordset ConnStr, sqlstr, Rs
Set GetValue = Rs
End Function
提示user-defined type not defined
谢谢了!
解决方案 »
- 请各路英雄来帮忙看看,连接字串这么写,为什么在我机器上老报错!
- 有没有这个函数?
- 用VC写的DLL在VB中调用,请问怎样传递字符串数组BOOL __stdcall SendArray(char szbuff[20][100]),谢谢~
- 用api打开文件夹的问题(做成组件的时候)
- ???如何用程序动态添加多个textbox控件???
- ■■■■如何判断treeview控件某一节点是否根节点
- 谁能告诉我这几段代码分别实现的什么功能?~~~急!!!!!!
- 在广州找工上哪个网
- 一个简单的SQL
- 如何才能让用API函数实现的文件打开对话框能够选择多个文件?
- 如何实现将CSV文件导入到ORACLE中?
- 求crystal report enterprise8.5的keycode,谢谢
我原先是用delphi的,所以只好来麻烦你们了,
Public Function GetValue(ByVal sqlstr As String) As adodb.Recordset
Dim Rs As new adodb.Recordset
Rs.open sql语句, Conn,加锁方式,读写方式
Set GetValue = Rs
End Function
提示user-defined type not defined
估计这样也不行,你那个错误是因为你没有定义adodb.Recordset,
如果你用Dim Rs As adodb.Recordset 定义后
你要在用该参数时必须要
set Rs=new adodb.recordset(vb对对象必须这样,.net里只要定义就好了,^_^)
才能用
不过你最好不要用adodb.Recordset来做返回值
工程-引用 microsoft activex data objects 2.5 library
Function GetValue(ByVal sqlstr As String) As adodb.Recordset
Dim Rs As adodb.Recordset
set rs = new ADODB.recordset
-----------
Set GetValue = Rs
End Function
Dim conn as adodb.Connection
Dim Rs As adodb.Recordset
Dim sql as string
sql = "SQL语句"
set conn = new adodb.connection
set rs = new ADODB.recordset
conn.open "连接字符串" '这个不用我写了吧~
rs.open sql,conn,打开方式,加锁方式
Set GetValue = Rs
End Function
Function GetValue(ByVal sqlstr As String) As adodb.Recordset
Dim conn as new adodb.Connection
Dim Rs As new adodb.Recordset
......
end function
加上new试试看
在VB或ASP中怎样接收这个函数返回的RecordSet对象?
我当时用的是
Dim objRS As New ADODB.Recordset
objRS = GetValue("参数值")结果提示:Invalid use of property