我正在創建一個Microsoft Access 2010數據庫,該數據庫將成爲客戶端的小型網站的一部分。我已經使用消息框進行了調試,並且能夠使用VBScript接受數據(客戶選擇他們願意更新/維護網站內容),我可以調用發送數據的子數據庫,但我無法通過與數據庫的連接。這是我有什麼:爲什麼我無法連接到我的訪問數據庫
Sub InsertIntoDatabase(FullName)
Dim strSQL, strConnect, strSQL2, i
Dim conn
Set conn = CreateObject("ADODB.Connection")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\userID\Desktop\My Stuff\MyData.accdb"
' Cannot get past this point. It's like I cannot connect to the path above.
conn.Open strConnect
strSQL = "INSERT INTO SurveyData (FullName, Address, City, State, Zip, Phone, Email, Pentium, PentiumMMX, Macintosh, Series486, Series386, Win2000, WinNT, WinXP, WinVista, Win7, Unix, Shopping"
strSQL2 = ") VALUES ('" & FullName & "', '" & Address & "', '" & City & "', '" & State & "', '" & Zip & "', '" & Phone & "', '" & Email & "', '" & Pent & "', '" & PentMMX & "', '" & Mac & "', '" & PC486 & "', '" & PC386 & "', '" & Win2000 & "', '" & WinNT & "', '" & WinXP & "', '" & WinVista & "', '" & Win7 & "', '" & Unix & "', '" & Shopping & "'"
' End the query string
strSQL = strSQL & strSQL2 & ")"
' Send the query to the database
conn.Execute strSQL
' Close the connection to the database
conn.Close
strSQL = ""
end sub
我有另一個網站,使用一個類似的腳本,那個作品。任何人都可以看到我失蹤的東西?
您已將帳戶主目錄中的數據庫文件。該網站(以及擴展名爲vbscript)運行的帳戶極不可能訪問該目錄。將數據庫移動到inet_pub的某個地方 –
@Marc B - 兩個數據庫都位於我的主目錄中。另一個數據庫是一個「.mdb」數據庫,其中新的數據庫是「.accdb」。這可能是問題嗎? – Lou
mdb是舊式訪問,accdb是在辦公室'07 –