如何将lotus notes数据库内容读出并写入sql server数据库
2个回答
展开全部
以下是一段用LS执行SQL查询的代码,供参考。
Uselsx "*LSXODBC"
Dim con As ODBCConnection
Dim qry As ODBCQuery
Dim result As ODBCResultSet
Dim firstName As String
Dim lastName As String
Dim msg As String
Sub Initialize
Set con = New ODBCConnection
Set qry = New ODBCQuery
Set result = New ODBCResultSet
Set qry.Connection = con
Set result.Query = qry
con.ConnectTo("ATDB")
qry.SQL = "SELECT * FROM STUDENTS"
If Not result.Execute Then
Messagebox result.GetExtendedErrorMessage,, _
result.GetErrorMessage
Exit Sub
End If
REM Display result set properties after Execute
Call DisplayResultSetProperties
msg = "Student names:" & Chr(10)
Do
result.NextRow
firstName = result.GetValue("FIRSTNAME", firstName)
lastName = result.GetValue("LASTNAME", lastName)
msg = msg & Chr(10) & firstName & " " & lastName
Loop Until result.IsEndOfData
Messagebox msg,, "Student Names"
REM Display result set properties after processing
REM result set
Call DisplayResultSetProperties
result.Close(DB_CLOSE)
con.Disconnect
End Sub
Sub DisplayResultSetProperties
If result.IsResultSetAvailable Then
If result.NumRows = DB_ROWSUNKNOWN Then
rows$ = "Not determined yet"
Else
rows$ = Cstr(result.NumRows)
End If
Messagebox _
"NumColumns = " & result.NumColumns & Chr(10) & _
"NumRows = " & rows$ & Chr(10) & _
"IsBeginOfData = " & result.IsBeginOfData & _
Chr(10) & "IsEndOfData = " & result.IsEndOfData & _
Chr(10) & "CurrentRow = " & result.CurrentRow,, _
"Result set properties"
Else
Messagebox "Result set not available",, _
"No result set"
End If
End Sub
其实,Notes的帮助中都有,仔细看看应该没什么问题的。
Uselsx "*LSXODBC"
Dim con As ODBCConnection
Dim qry As ODBCQuery
Dim result As ODBCResultSet
Dim firstName As String
Dim lastName As String
Dim msg As String
Sub Initialize
Set con = New ODBCConnection
Set qry = New ODBCQuery
Set result = New ODBCResultSet
Set qry.Connection = con
Set result.Query = qry
con.ConnectTo("ATDB")
qry.SQL = "SELECT * FROM STUDENTS"
If Not result.Execute Then
Messagebox result.GetExtendedErrorMessage,, _
result.GetErrorMessage
Exit Sub
End If
REM Display result set properties after Execute
Call DisplayResultSetProperties
msg = "Student names:" & Chr(10)
Do
result.NextRow
firstName = result.GetValue("FIRSTNAME", firstName)
lastName = result.GetValue("LASTNAME", lastName)
msg = msg & Chr(10) & firstName & " " & lastName
Loop Until result.IsEndOfData
Messagebox msg,, "Student Names"
REM Display result set properties after processing
REM result set
Call DisplayResultSetProperties
result.Close(DB_CLOSE)
con.Disconnect
End Sub
Sub DisplayResultSetProperties
If result.IsResultSetAvailable Then
If result.NumRows = DB_ROWSUNKNOWN Then
rows$ = "Not determined yet"
Else
rows$ = Cstr(result.NumRows)
End If
Messagebox _
"NumColumns = " & result.NumColumns & Chr(10) & _
"NumRows = " & rows$ & Chr(10) & _
"IsBeginOfData = " & result.IsBeginOfData & _
Chr(10) & "IsEndOfData = " & result.IsEndOfData & _
Chr(10) & "CurrentRow = " & result.CurrentRow,, _
"Result set properties"
Else
Messagebox "Result set not available",, _
"No result set"
End If
End Sub
其实,Notes的帮助中都有,仔细看看应该没什么问题的。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2010-02-27
展开全部
1、可以用ODBC来连接, IBM推出了Notessql ,大部分都是可以写过来的
2、如果版本为NOTES8,可以用DM的服务直接写
2、如果版本为NOTES8,可以用DM的服务直接写
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询