vb连接oracle 10g
各位大神!小弟有一个vb程序是向led显示屏发数据的 原来用的sqlser 现在要换oracle怎么弄啊!
Option Explicit
Dim result As Integer, i As Integer
Dim s As String, s1 As String, s2 As String, s3 As String
Dim Strdate As Date
Dim strConn As String
Dim Rs As New ADODB.Recordset
Dim Rs1 As New ADODB.Recordset
Dim Rs2 As New ADODB.Recordset
Dim Rs3 As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Private Declare Function ExtractIconEx Lib "shell32.dll" Alias "ExtractIconExA" (ByVal lpszFile As String, ByVal nIconIndex As Long, phIconLarge As Long, phIconSmall As Long, ByVal nIcons As Long) As Long
'从指定文件中提取图标
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'向指定窗口发送消息
Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long
'消毁图标
Dim lHSmallIcon As Long '小图标句柄
Private Sub Timer1_Timer()
i = i + 1
Label6.Caption = Time
If i >= 120 Then
i = 0
Text5.text = Format(Now, "yyyy/mm/dd") '获取本机当前日期
Text6.text = Format(Now, "HH:MM") '获取本机当前时间
' Text15.text = Format(Now - #12:05:00 AM#, "HH:MM")
On Error GoTo ErrMsg
If Conn.State = adStateOpen Then
Conn.Close
End If '判断数据库是否已经打开 如果打开则先关闭
strConn = "Provider=SQLOLEDB;Initial Catalog=ecology;Data Source=192.168.1.7;User ID=sa;Password=cology"
Conn.Open strConn
'二楼一号会议室
Rs.Open "Select name,begintime,endtime from meeting where enddate = '" & Text5.text & "' and address = '9' and endtime > '" & Text6.text & "' and isdecision = 0 and meetingstatus <> 1", Conn, adOpenStatic, adLockOptimistic
Rs1.Open "Select name,begintime,endtime from meeting where enddate = '" & Text5.text & "' and address = '10' and endtime > '" & Text6.text & "' and isdecision = 0 and meetingstatus <> 1", Conn, adOpenStatic, adLockOptimistic
Rs2.Open "Select name,begintime,endtime from meeting where enddate = '" & Text5.text & "' and address = '11' and endtime > '" & Text6.text & "' and isdecision = 0 and meetingstatus <> 1", Conn, adOpenStatic, adLockOptimistic
Rs3.Open "Select name,begintime,endtime from meeting where enddate = '" & Text5.text & "' and address = '12' and endtime > '" & Text6.text & "' and isdecision = 0 and meetingstatus <> 1", Conn, adOpenStatic, adLockOptimistic
If Rs.RecordCount > 0 Then
s = Rs.GetString()
s = Replace(s, Chr(13), " ")
s = Replace(s, vbTab, "-")
Text1.text = s
Else
s = " 空闲"
End If
If Rs1.RecordCount > 0 Then
s1 = Rs1.GetString()
s1 = Replace(s1, Chr(13), " ")
s1 = Replace(s1, vbTab, "-")
Text2.text = s1
Else
s1 = " 空闲"
End If
If Rs2.RecordCount > 0 Then
s2 = Rs2.GetString()
s2 = Replace(s2, Chr(13), " ")
s2 = Replace(s2, vbTab, "-")
Text3.text = s2
Else
s2 = " 空闲"
End If
If Rs3.RecordCount > 0 Then
' s3 = Rs3.GetString(): Text4.text = s3
s3 = Rs3.GetString()
s3 = Replace(s3, Chr(13), " ")
s3 = Replace(s3, vbTab, "-")
Text4.text = s3
Else
s3 = " 空闲"
End If
Text1.text = s
Text2.text = s1
Text3.text = s2
Text4.text = s3
Rs.Close
Rs1.Close
Rs2.Close
Rs3.Close
Conn.Close
ErrMsg:
'开始发送数据到屏幕
result = SetTransMode(1, 3)
'result = SetSerialPortPara(1, 1, 115200)
result = SetNetworkPara(1, "192.168.1.96")
StartSend
result = AddControl(1, 2)
result = AddProgram(1, 1, 0)
result = AddQuitText(1, 1, 1, 0, 7, 88, 22, 255, "宋体", 12, 0, 0, 0, "一号会议室:")
result = AddQuitText(1, 1, 1, 0, 29, 88, 22, 255, "宋体", 12, 0, 0, 0, "二号会议室:")
result = AddQuitText(1, 1, 1, 0, 51, 88, 22, 255, "宋体", 12, 0, 0, 0, "三号会议室:")
result = AddQuitText(1, 1, 1, 0, 73, 88, 22, 255, "宋体", 12, 0, 0, 0, "四号会议室:")
If Text1.text = " 空闲" Then
' result = AddSingleLnTxt(1, 1, 1, 88, 7, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text1.text, 28, 1)
result = AddQuitText(1, 1, 1, 88, 7, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text1.text)
Else
'result = AddQuitText(1, 1, 1, 88, 7, 232, 22, 255, "宋体", 12, 0, 0, 0, Text1.text)
result = AddSingleLnTxt(1, 1, 1, 88, 7, 232, 22, 65535, "宋体", 12, 0, 0, 0, Text1.text, 0, 1)
End If
If Text2.text = " 空闲" Then
'result = AddSingleLnTxt(1, 1, 1, 88, 29, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text2.text, 28, 1)
result = AddQuitText(1, 1, 1, 88, 29, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text2.text)
Else
'result = AddQuitText(1, 1, 1, 88, 29, 232, 22, 255, "宋体", 12, 0, 0, 0, Text2.text)
result = AddSingleLnTxt(1, 1, 1, 88, 29, 232, 22, 65535, "宋体", 12, 0, 0, 0, Text2.text, 0, 1)
End If
If Text3.text = " 空闲" Then
'result = AddSingleLnTxt(1, 1, 1, 88, 51, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text3.text, 28, 1)
result = AddQuitText(1, 1, 1, 88, 51, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text3.text)
Else
'result = AddQuitText(1, 1, 1, 88, 51, 232, 22, 255, "宋体", 12, 0, 0, 0, Text3.text)
result = AddSingleLnTxt(1, 1, 1, 88, 51, 232, 22, 65535, "宋体", 12, 0, 0, 0, Text3.text, 0, 1)
End If
If Text4.text = " 空闲" Then
' result = AddSingleLnTxt(1, 1, 1, 88, 73, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text4.text, 28, 1)
result = AddQuitText(1, 1, 1, 88, 73, 232, 22, 65280, "宋体", 12, 0, 0, 0, Text4.text)
Else
'result = AddQuitText(1, 1, 1, 88, 72, 232, 22, 255, "宋体", 12, 0, 0, 0, Text4.text)
result = AddSingleLnTxt(1, 1, 1, 88, 73, 232, 22, 65535, "宋体", 12, 0, 0, 0, Text4.text, 0, 1)
End If
result = SendControl(1, 1, 0)
Label1.Caption = "系统提示您" & Time & "发送成功"
End If
End Sub
[解决办法]
不知道
[解决办法]
一个问题不要变着法子地提问。
http://bbs.csdn.net/topics/390277931