SuperComputing
IS-IT--Management
I need to pull several columns from a table on a SQL server and then populate a Access mdb with the data.
I have searched for software, but can only find apps that convert mdb to sql, the opposite of what I need.
I've tried an asp page and can sucessfully pull the data that I need. I can even create the mdb file, but I cant 'push' the data into it. Even if I had to use an existing, empty mdb as a template, that would be fine.
Here's what I have so far:
I know the 'Request.Form' lines aren't right, but I was trying it as an asp form. I just don't know how to make the page auto-populate the mdb when the page loads.
Anyone help me 'fill in the blanks?'
I have searched for software, but can only find apps that convert mdb to sql, the opposite of what I need.
I've tried an asp page and can sucessfully pull the data that I need. I can even create the mdb file, but I cant 'push' the data into it. Even if I had to use an existing, empty mdb as a template, that would be fine.
Here's what I have so far:
Code:
<%
Dim CONN_STRING, filepath
CONN_STRING = "DSN=CPDATA;"
filepath = "c:\inetpub\[URL unfurl="true"]wwwroot\cpinventory\files\"[/URL]
%>
<%
Set connSQL = Server.CreateObject("ADODB.Connection")
connSQL.open = CONN_STRING
strQuerySQL = "SELECT ItemNumber, Description1, Description2, Attribute1 AS Color, Attribute3 AS Size, Weight, Price1 AS Price, QtyOnHand - QtyCommitted AS Qty FROM Items WHERE Ecommerce = 'Y' AND Price1 > '0' ORDER BY ItemNumber"
Set rsSQL = connSQL.Execute(strQuerySQL)
%>
<%
set connMDB=Server.CreateObject("ADODB.Connection")
connMDB.Provider="Microsoft.Jet.OLEDB.4.0"
connMDB.Open filepath & "onlineinv.mdb"
set rsMDB=Server.CreateObject("ADODB.Recordset")
rsMDB.open "SELECT * FROM inv WHERE ItemNumber='" & ItemNum & "'",connMDB
%>
<%
sql="UPDATE inv SET "
sql=sql & "ItemNumber='" & Request.Form("ItemNumber") & "',"
sql=sql & "Description1='" & Request.Form("Description1") & "',"
sql=sql & "Description2='" & Request.Form("Description2") & "',"
sql=sql & "Color='" & Request.Form("Color") & "',"
sql=sql & "Size='" & Request.Form("Size") & "',"
sql=sql & "Weight='" & Request.Form("Weight") & "'"
sql=sql & "Price='" & Request.Form("Price") & "'"
sql=sql & "Qty='" & Request.Form("Qty") & "'"
sql=sql & " WHERE ItemNumber='" & ItemNum & "'"
on error resume next
conn.Execute sql
%>
<%
connSQL.close
Set connSQL = Nothing
Set rsSQL = Nothing
connMDB.close
Set connMDB = Nothing
Set rsMDB = Nothing
%>
I know the 'Request.Form' lines aren't right, but I was trying it as an asp form. I just don't know how to make the page auto-populate the mdb when the page loads.
Anyone help me 'fill in the blanks?'