louts中如何访问oracle数据库
louts中如何访问oracle数据库?在louts中执行相关的SQL语句去查询oracle中的数据,并返回到louts的表单中,请问各位大侠有相关例子吗?
可以用JDBC来访问Oracle,至于例子,可以搜索度娘,大量的Java访问Oracle的代码
也可以用ODBC来访问Oracle,例子,也可以搜索度娘,大量的VB访问Oracle的代码
用下面的这段代码访问Sql Server 数据库没有问题。但是将红色字体部分的链接字符串换成下面蓝色字体链接ORACLE的点击时loust就提示“OraOLEDBbus.dll 找不到模块”。而此字符串连接在VB6.0中调试通过,请问各位大侠有什么办法解决?十分感谢!
ConnectionString = "Provider=OraOLEDB.Oracle.1;Persist Security Info=True;uid=**; pwd=**;Data Source=**"
===============================================================
Sub Click(Source As Button)
Dim Session As NotesSession
Dim DB As NotesDatabase
Dim View As NotesView
Dim CurDoc As NotesDocument
Dim uidoc As NotesUIDocument
Dim Ws As New NotesUIWorkspace
'定义ADO对象变量,供SQL用
Dim Connect As Variant
Dim ADOCommand As Variant
Dim RecordSet As Variant
On Error Goto ErrorHandle
Set Session = New Notessession
Set DB = Session.CurrentDatabase
Set Doc = Session.DocumentContext
Set Uidoc = Ws.CurrentDocument
Set Curdoc= Uidoc.Document
Set Connect = CreateObject( "ADODB.Connection" ) '创建ADO连接对象
Set Recordset = CreateObject( "ADODB.Recordset" ) '创建返回结果集对象
'取得SQL服务器的IP地址
SQLSERVER = "10.1.1.x"
'要连接的SQL库
SQLDB = "数据库名称"
'SQL用户名
SQLUID = "sa"
'SQL密码
SQLPWD = "xxxxxxx"
'与SQL服务器连接的语句
[b]ConnectionString = |Driver={SQL SERVER};SERVER=| + SQLSERVER + |;DATABASE=| + SQLDB + |;UID=| + SQLUID + |;PWD=| + SQLPWD + |;|[/b]
Connect.Open ConnectionString '创建SQL连接
If Connect.State <> 1 Then
Msgbox "连接中断,请稍后再试!"
Exit Sub
End If
Query = "SELECT Prjname FROM OPRJ where prjcode = '" & Curdoc.Prjcode(0) & " '"
RecordSet.Open Query, Connect '执行SQL语句并返回结果
'从SQL读取主表信息
If Not Recordset.Eof Then
Curdoc.Prjname = RecordSet.Fields("Prjname").Value
Else
Msgbox "对不起,不存在该编码"
End If
Call Recordset.Close '关闭结果集
Call Connect.close '关闭SQL连接
Exit Sub
ErrorHandle:
Msgbox Str(Erl())+ Error()
End Sub