关于vb连接oracle的问题 使用ADO控件,自已查一下属性就行了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 和sql差不多.Provider = "MSDataShape".Open "Driver={Microsoft ODBC for Oracle};Server=" & strServerName, strUserName, strUserPwd 1 Must install oracle SQL*NET2 Configure the connection to the Oracle Server(Use SQL*NET Easy configuration)3 Establish ADO connection,there two ways:use microsoft oracle oledb or odbc driver strConnectString = "Provider=OraOLEDB.Oracle.1;Password=" & strPassWord & _ ";User ID=" & strUID & ";Data Source=" & strDBName & ";DistribTx=0"最后一个参数很有必要 给你一个现成的例子(注意:1)需要先将“ADO ...”加入 VBP,具体方法为:"Project --> "References"后出现的选择对话框中选中“MicorSoft ActiveX Data Object 2.0 Libtary”")2)ADO_XXX是从控制面板设置的ODBC连接串名称.3)还有问题的话请留短消息--我不保证每次都看一样的问题。'' @(h) modAdoApp.bas''Use:' Ado 实用函数'''First Creat Author : TNT1900'Frist Creat Date : 2002.07.12''Last Vindicator : TNT1900'Last Modify Date : 2002.08.01'Option Explicit'' 全局数据库连接串Global Const G_ADO_ConStr As String = "Provider=MSDAORA.1; " & _ "User ID=UserID; password=PSW; Data Source=ADO_XXX; Persist Security Info=False"''Use:' 根据指定的 SQL 语句和具体可选条件执行 SQL 命令并返回相应的结果''Input:' strSource : 完整、有效的语句如SQL语句等' Optional intCursorType As CursorTypeEnum = adOpenForwardOnly,' Optional intLockType As LockTypeEnum = adLockReadOnly,' Optional intOptns As CommandTypeEnum = adCmdText,' Optional intDynaFlag As Integer = 0 : 默认不需要 RecordCount,为 1 则该属性有效''Return:' 相应的记录集结果''Call Example:' intRtn = cgfn_GetDataBySourceAndOptn("Select * from T_Employee")''Notice:' 数据的唯一性由数据库保证。''First Creat Author : TNT1900'Frist Creat Date : 2002.07.12''Last Vindicator : TNT1900'Last Modify Date : 2002.07.12'Public Function cgfn_GetDataBySourceAndOptn( _ ByVal strSource As String, _ Optional intCursorType As CursorTypeEnum = adOpenForwardOnly, _ Optional intLockType As LockTypeEnum = adLockReadOnly, _ Optional intOptns As CommandTypeEnum = adCmdText, _ Optional intDynaFlag As Integer = 0 _) As ADODB.Recordset On Error GoTo ErrorProcess Dim Conn As ADODB.Connection Dim p_RS As ADODB.Recordset '' 如果SQL语句什么也没有的话则什么也不做,直接退出 If strSource = "" Then Exit Function '' Initialize the ADODB connection and recordset Set Conn = New ADODB.Connection Set p_RS = New ADODB.Recordset '' 此参数专门为 ORACLE 量身定制:指定此参数=1时,才能得到 Recordcount等属性 If intDynaFlag = 1 Then p_RS.CursorLocation = adUseClient End If '' Open the Connection Conn.Open G_ADO_ConStr '' Get the recordset p_RS.Open strSource, Conn, intCursorType, intLockType, intOptns '' Return the value Set cgfn_GetDataBySourceAndOptn = p_RS '' Normal Exit Exit Function '' 出错处理ErrorProcess: 'cgsb_ErrorProcess "modAdoApp.cgfn_GetDataBySourceAndOptn()" Resume Next '' 跳到当前程序的下一步,continueEnd Function 我用ADO,但有一个ORACLE的控件~~~http://www.oradb.net/setup/vbora_002.htm VB GetForegroundWindow ShowWindow api操作treeview (操作阿里旺旺的好友列表) 给大家做两个编程题目! 请问如何得到datagrid的行数 vb中怎样把一个长整数表示的秒数转变为日期格式的时间? 请教 windows media player 的属性和方法 100分 我用RDO打开了一个连接,想接下为的操作都在本地进行,是否可行? 如何计算excel 工作表数据的总行数 谁有水晶报表的注册码? 遇到的奇怪问题。。。100分啊 谁有VB+ACCESS的教程什么的,发点给我,谢谢了? 急用!!!请帮忙!!!
.Provider = "MSDataShape"
.Open "Driver={Microsoft ODBC for Oracle};Server=" & strServerName, strUserName, strUserPwd
2 Configure the connection to the Oracle Server(Use SQL*NET Easy configuration)
3 Establish ADO connection,there two ways:use microsoft oracle oledb or odbc driver
";User ID=" & strUID & ";Data Source=" & strDBName & ";DistribTx=0"
最后一个参数很有必要
(注意:
1)需要先将“ADO ...”加入 VBP,具体方法为:"Project --> "References"后出现的选择对话框中选中“MicorSoft ActiveX Data Object 2.0 Libtary”")
2)ADO_XXX是从控制面板设置的ODBC连接串名称.
3)还有问题的话请留短消息--我不保证每次都看一样的问题。'
' @(h) modAdoApp.bas
'
'Use:
' Ado 实用函数
'
'
'First Creat Author : TNT1900
'Frist Creat Date : 2002.07.12
'
'Last Vindicator : TNT1900
'Last Modify Date : 2002.08.01
'Option Explicit'' 全局数据库连接串
Global Const G_ADO_ConStr As String = "Provider=MSDAORA.1; " & _
"User ID=UserID; password=PSW; Data Source=ADO_XXX; Persist Security Info=False"
'
'Use:
' 根据指定的 SQL 语句和具体可选条件执行 SQL 命令并返回相应的结果
'
'Input:
' strSource : 完整、有效的语句如SQL语句等
' Optional intCursorType As CursorTypeEnum = adOpenForwardOnly,
' Optional intLockType As LockTypeEnum = adLockReadOnly,
' Optional intOptns As CommandTypeEnum = adCmdText,
' Optional intDynaFlag As Integer = 0 : 默认不需要 RecordCount,为 1 则该属性有效
'
'Return:
' 相应的记录集结果
'
'Call Example:
' intRtn = cgfn_GetDataBySourceAndOptn("Select * from T_Employee")
'
'Notice:
' 数据的唯一性由数据库保证。
'
'First Creat Author : TNT1900
'Frist Creat Date : 2002.07.12
'
'Last Vindicator : TNT1900
'Last Modify Date : 2002.07.12
'
Public Function cgfn_GetDataBySourceAndOptn( _
ByVal strSource As String, _
Optional intCursorType As CursorTypeEnum = adOpenForwardOnly, _
Optional intLockType As LockTypeEnum = adLockReadOnly, _
Optional intOptns As CommandTypeEnum = adCmdText, _
Optional intDynaFlag As Integer = 0 _
) As ADODB.Recordset
On Error GoTo ErrorProcess
Dim Conn As ADODB.Connection
Dim p_RS As ADODB.Recordset
'' 如果SQL语句什么也没有的话则什么也不做,直接退出
If strSource = "" Then Exit Function
'' Initialize the ADODB connection and recordset
Set Conn = New ADODB.Connection
Set p_RS = New ADODB.Recordset
'' 此参数专门为 ORACLE 量身定制:指定此参数=1时,才能得到 Recordcount等属性
If intDynaFlag = 1 Then
p_RS.CursorLocation = adUseClient
End If
'' Open the Connection
Conn.Open G_ADO_ConStr
'' Get the recordset
p_RS.Open strSource, Conn, intCursorType, intLockType, intOptns
'' Return the value
Set cgfn_GetDataBySourceAndOptn = p_RS
'' Normal Exit
Exit Function
'' 出错处理
ErrorProcess:
'cgsb_ErrorProcess "modAdoApp.cgfn_GetDataBySourceAndOptn()"
Resume Next '' 跳到当前程序的下一步,continue
End Function
http://www.oradb.net/setup/vbora_002.htm