Sub Initialize Dim session As New NotesSession Dim doc As NotesDocument '当前文档的后台文档 Dim tobeSearchDb As NotesDatabase '待搜索的数据库 Dim DstDocs As NotesDocumentCollection '搜索结果集 Dim RstDoc As NotesDocument '查询到的文档 Dim sRstView As NotesView '结果显示视图 Set Db=Session.CurrentDatabase Set doc=session.DocumentContext Dim con As ODBCConnection Dim userName As String Dim password As String Dim qry As ODBCQuery Dim result As ODBCResultSet Dim A As String Set con = New ODBCConnection Set qry = New ODBCQuery Set result = New ODBCResultSet Set qry.Connection = con Set result.Query = qry A=con.ConnectTo("CoprYW","sa","123") qry.SQL = " INSERT INTO mt(phone,msg_content,sm_flag) VALUES ('"+doc.SMSendTo(0)+"','"+doc.SMBody(0)+"','1'); " 'Call JSAction("Alert",Cstr(a)) If Not result.Execute Then 'Messagebox _ 'result.GetExtendedErrorMessage,, result.GetErrorMessage 'Exit Sub End If result.Close(DB_CLOSE) con.Disconnect End Sub