|
|
发表于 2003/11/3 15:59:54
|
显示全部楼层
刚刚测试了一下,改进了一点东西,给大家共享!
域Name文本类型 Birth时间类型 Age数字类型 Word 文本类型
Sub click (source As button)
Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Dim view As notesview
Dim con As New odbcconnection
Dim qry As New odbcquery
Dim result As New odbcresultset
Set uidoc=w.currentdocument
Set doc=uidoc.document
REM 連接數據庫
If con.connectto("TestForLouts") Then
Set qry.connection=con
qry.sql="select * from Table1"
Set result.query=qry
qry.sql= "insert into TABLE1(Name,Birth,Age,Word) values('" + doc.Name(0) + "','" + Cstr(doc.Birth(0)) + "','" +Cstr(doc.Age(0)) + "','" +doc.Word(0) + "')"
Call result.execute()
Call result.addrow()
REM //添加一行
Call result.updaterow
REM //保存數據
Call con.disconnect()
Messagebox("save the date")
Else
Messagebox("do not save")
End If
result.close(db_close)
con.disconnect
End Sub
  |
|