sjc2309
asked on
Website linked to Access Database
Hi all,
I am trying to create a website which is linked to a MS Access Database and uses that to display "live" data on an HTML page, allowing users to view and input data.
How would I do this???
Thanks for help...
seb
I am trying to create a website which is linked to a MS Access Database and uses that to display "live" data on an HTML page, allowing users to view and input data.
How would I do this???
Thanks for help...
seb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please provide a little more specifics. I included a section in my previos comment on how to insert into a database. Did this not work? Did you need more guidance on that section?
RCMB
RCMB
Yes, I followed your instruction. Below is the asp code for you to review. When I hit the submit button, I got this confirmation page:
Form Confirmation
Thank you for submitting the following information:
judul: test
komentar: test
Submit: Submit
Return to the form.
However, when I looked up the table in MS Access, I don't see this new record.
Any idea why?
Thanks for the help,
Supri
Note:
Database name is Opiniku.
Table name is Komentar. There are 2 fields in there: judul(type:text) and komentar(type:memo).
ASP Code:
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear
strErrorUrl = ""
If Request.ServerVariables("R EQUEST_MET HOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB .Connectio n")
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB .Recordset ")
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("Opiniku_Conne ctionStrin g")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Komentar", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(2)
Dim arFormDBFields0(2)
Dim arFormValues0(2)
arFormFields0(0) = "komentar"
arFormDBFields0(0) = "Komentar"
arFormValues0(0) = Request("komentar")
arFormFields0(1) = "judul"
arFormDBFields0(1) = "Judul"
arFormValues0(1) = Request("judul")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"kirimKomentar.asp",_
"Return to the form."
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<html>
<head>
<meta http-equiv="Content-Langua ge" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor. Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Judul</title>
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="_fpclas s/fpdbform .inc" s-dataconnection="Opiniku" s-recordsource="Komentar" u-database-url="fpdb/opini ku.mdb" s-form-fields="komentar judul" s-form-dbfields="Komentar Judul" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.in c"--><!--w ebbot bot="SaveDatabase" endspan i-checksum="40548" --><p>
Judul:</p>
<p><input type="text" name="judul" size="20"></p>
<p>Komentar:</p>
<p><textarea rows="2" name="komentar" cols="20"></textarea></p>
<p><input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="Reset"></p>
</form>
</body>
</html>
Form Confirmation
Thank you for submitting the following information:
judul: test
komentar: test
Submit: Submit
Return to the form.
However, when I looked up the table in MS Access, I don't see this new record.
Any idea why?
Thanks for the help,
Supri
Note:
Database name is Opiniku.
Table name is Komentar. There are 2 fields in there: judul(type:text) and komentar(type:memo).
ASP Code:
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear
strErrorUrl = ""
If Request.ServerVariables("R
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("Opiniku_Conne
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Komentar", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(2)
Dim arFormDBFields0(2)
Dim arFormValues0(2)
arFormFields0(0) = "komentar"
arFormDBFields0(0) = "Komentar"
arFormValues0(0) = Request("komentar")
arFormFields0(1) = "judul"
arFormDBFields0(1) = "Judul"
arFormValues0(1) = Request("judul")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"kirimKomentar.asp",_
"Return to the form."
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<html>
<head>
<meta http-equiv="Content-Langua
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Judul</title>
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="_fpclas
Judul:</p>
<p><input type="text" name="judul" size="20"></p>
<p>Komentar:</p>
<p><textarea rows="2" name="komentar" cols="20"></textarea></p>
<p><input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="Reset"></p>
</form>
</body>
</html>
I uploaded your code and created the database per your example. I made no modifications to your code and the form inserted data into the database with no errors.
Did you save the file as .asp vice .htm?
Make sure you link the fields to the form -- right click on the form and click on form properties
Click on Options, Saved Fields and make sure your form fields are linked to the database fields.
RCMB
Did you save the file as .asp vice .htm?
Make sure you link the fields to the form -- right click on the form and click on form properties
Click on Options, Saved Fields and make sure your form fields are linked to the database fields.
RCMB
Yes, I did the Options thing and I checked, all the fields are linked to the database. I saved the file as .asp as well. It seems that when I hit the submit button, data is not transferred to the database at all. Is there anything that I need to tweak in Access? Can I set up a trace file to make sure that the data is actually inserted into the database? I don't think it's the connection problem since I am able to retrieve the data and view them on the page.
Thanks,
Supri
Thanks,
Supri
I think you need to give write/update permissions to the database.
Use Windows Explorer to reach the database and right click on it and select properties. Under the securities tab, add the following users (IUSR_YourServername and IWAM_YourServername) and give permissions to read, write and execute.
Make sure you replace Yourservername with the name of your server.
:) SD
Use Windows Explorer to reach the database and right click on it and select properties. Under the securities tab, add the following users (IUSR_YourServername and IWAM_YourServername) and give permissions to read, write and execute.
Make sure you replace Yourservername with the name of your server.
:) SD
Btw, the original poster of this question is sjc2309!
sjc2309, did any of this help you?
:) SD
sjc2309, did any of this help you?
:) SD
I was trying to do that but I can only retrieve data from Access but unable to insert them.
Anything else I need to do?
Thanks,
Supri