# OLE与资料库

Posted by yeong huann on January 09, 1999 at 16:43:04:

以下是我的程式片段 (请各位高手予以指导)
Set mydb = Workspaces(0).CreateDatabase(App.Path & "\" &_ Me.Text1.Text, dbLangGeneral, dbEncrypt)
Set newtable = mydb.CreateTableDef(Me.Text1.Text)
With newtable
.Fields.Append .CreateField("序号", dbInteger, 4)
.Fields.Append .CreateField("图档路径", dbText, 50)
.Fields.Append .CreateField("图示", dbLongBinary)'该栏位将会写入OLE元件连结的资料(AUTOCAD图档)
.Fields.Append .CreateField("建立日期", dbDate)
End With
.
.
.

Private Sub Command1_Click()
If Me.Text1.Text = "" Then
MsgBox "你尚未选定图档", 64
GoTo exit_add_data
Else
End If
Dim mydb As Database
Dim myset As Recordset

Set mydb = Workspaces(0).OpenDatabase(App.Path & "\" & Me.Text2.Text_ & ".mdb")
Set myset = mydb.OpenRecordset(Me.Text2.Text, dbOpenTable)
myset.AddNew
myset![序号] = Me.Text3.Text
myset![图档路径] = Me.Text1.Text
myset![图示] = <<------------------------(请问OLE的栏位该如何写_入)
myset![建立日期] = Date
myset.Update

Set myset = Nothing
Set mydb = Nothing
Data1.Refresh

exit_add_data:

End Sub

Follow Ups:

- Re: OLE与资料库 阿晴 17:58:28 1/11/99 (0)