SharePoint 테이블에 쓰는 데 문제가 있습니다. ADODB를 통해 연결할 수 있습니다. 나는 vb.net 응용 프로그램을 작성 중이며, 내 컴퓨터에서 작동하지만 프로젝트를 컴파일하고 릴리스하면 배포 된 후에 다음 오류가 계속 표시됩니다.ADODB SharePoint 테이블을 찾을 수 없습니다.
The Microsoft Office Access database engine could not find the object 'Table_Name
는 ADODB 연결 개체가 성공적으로 열어 가고 있습니다,하지만 난 CommitTrans
또는 .Execute
메서드를 호출 할 때이 오류가 발생합니다. SharePoint 버전은 Office 365입니다.
내가 간과하는 것이 있습니까?
코드 :
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Add.Click
Dim connection As ADODB.Connection = connectDb()
Dim rs As New ADODB.Recordset
Try
If Not connection Is Nothing Then
Me.TextBox1.Text = "Connected"
Me.Refresh()
Else
Me.TextBox1.Text = "Connection Failed"
End If
Dim i As Byte
Dim AppendSQL As String = "Insert Into Table ([Count], [Date], UserName, AppName, WindowTitle, URL, ProductiveTime, IdleTime) " & _
"Values (1,#1/20/2017#,'','','','',1,1)"
rs.Open("Select top 1 * from Table", connection, 2, 3)
connection.BeginTrans()
For i = 1 To 5
With rs
.AddNew()
.Fields(0).Value = 1
.Fields(1).Value = "Example"
.Update()
End With
Next
connection.committrans()
MsgBox("Data should have been written to SharePoint")
Catch ex As Exception
MsgBox("An error occurred: " & ex.Message)
End Try
End Sub
Function connectDb() As Object
Try
Dim connection As Object = CreateObject("Adodb.connection")
Const ListID As String = "{61C6957D-37A9-440C-A79D-A85D15C95F91};"
Const ViewID As String = "{0C93F8A2-00FB-42E7-80A9-1FE82F7FAB3D};"
Const ConnectionStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;HDR=Yes;IMEX=0;RetrieveIds=Yes;" & _
"DATABASE=https://mywebsite/sites/thesiteName/;" & _
"LIST=" & ListID & _
"VIEW=" & ViewID
With connection
.connectionstring = ConnectionStr
.Mode = ADODB.ConnectModeEnum.adModeWrite
.open()
End With
connectDb = connection
Catch ex As Exception
MsgBox("An error occurred: " & ex.Message)
connectDb = Nothing
End Try
End Function
End Class