kojoman
asked on
create access db and fill'er up - HOW? (asp -vbscript-adox)
I'm tearing my hair! Why the bloody h... wont this work???
I'm creating an access database file in ASP and ADOX.
This works great, but no records get put in it. no errors or anything just plain empty.
this is my code:
<!--#include file="../../../../../progr am files/common files/System/ado/adovbs.in c"-->
<%
Const Jet10 = 1
Const Jet11 = 2
Const Jet20 = 3
Const Jet3x = 4
Const Jet4x = 5
dim dbName, tableName, dbPath, rs_q, sql, fso
dbName = "C:\inetpub\wwwroot\survey \avmedia\L ibrary\joh an.mdb"
tableName = "test"
dbPath="../Library/"&right (dbName,(l en(dbName) -42))
set fso=server.CreateObject("S cripting.F ileSystemO bject")
Function dbReady(dbName)
dbReady = fso.FileExists(dbName)
End Function
Sub CreateNewMDB(FileName, Format, tableName, tableId)
Dim Catalog
Set Catalog = CreateObject("ADOX.Catalog ")
Catalog.Create "Provider=Microsoft.Jet.OL EDB.4.0;Je t OLEDB:Engine Type=" & Format & ";Data Source=" & FileName
Dim TheTable
Set TheTable = Server.CreateObject("ADOX. Table")
TheTable.Name = tableName
TheTable.Columns.Append "id", adInteger
TheTable.Columns.Append "namn", adLongVarWChar, 255
TheTable.Columns.Append "tel", adLongVarWChar, 255
TheTable.Keys.Append "PK_id", 1, "id"
Catalog.Tables.Append TheTable
set conn2 = server.CreateObject("ADODB .connectio n")
conn2.open(catalog.activeC onnection)
conn2.execute("INSERT INTO test VALUES(123,'asdfsafd','saf sfdsaf')")
Set TheTable = Nothing
Set Catalog = Nothing
End Sub
if dbReady(dbName) then fso.DeleteFile(dbName)
CreateNewMDB dbName, Jet4x, tableName, request.QueryString("surve y_id")
do
i=i+1
if dbReady(dbName) then exit do
if i >=10000 then
response.Write("error :(")
exit do
end if
loop
response.Redirect(dbPath)
%>
please help
I'm creating an access database file in ASP and ADOX.
This works great, but no records get put in it. no errors or anything just plain empty.
this is my code:
<!--#include file="../../../../../progr
<%
Const Jet10 = 1
Const Jet11 = 2
Const Jet20 = 3
Const Jet3x = 4
Const Jet4x = 5
dim dbName, tableName, dbPath, rs_q, sql, fso
dbName = "C:\inetpub\wwwroot\survey
tableName = "test"
dbPath="../Library/"&right
set fso=server.CreateObject("S
Function dbReady(dbName)
dbReady = fso.FileExists(dbName)
End Function
Sub CreateNewMDB(FileName, Format, tableName, tableId)
Dim Catalog
Set Catalog = CreateObject("ADOX.Catalog
Catalog.Create "Provider=Microsoft.Jet.OL
Dim TheTable
Set TheTable = Server.CreateObject("ADOX.
TheTable.Name = tableName
TheTable.Columns.Append "id", adInteger
TheTable.Columns.Append "namn", adLongVarWChar, 255
TheTable.Columns.Append "tel", adLongVarWChar, 255
TheTable.Keys.Append "PK_id", 1, "id"
Catalog.Tables.Append TheTable
set conn2 = server.CreateObject("ADODB
conn2.open(catalog.activeC
conn2.execute("INSERT INTO test VALUES(123,'asdfsafd','saf
Set TheTable = Nothing
Set Catalog = Nothing
End Sub
if dbReady(dbName) then fso.DeleteFile(dbName)
CreateNewMDB dbName, Jet4x, tableName, request.QueryString("surve
do
i=i+1
if dbReady(dbName) then exit do
if i >=10000 then
response.Write("error :(")
exit do
end if
loop
response.Redirect(dbPath)
%>
please help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had it like that from the beginning, but then there were some other stuff that didn't work and in the intense debugging I changed it to see if that solved the current problem, which didn't get affected at all.
It works great now. Thanks a lot.
-johan