By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,087 Members | 1,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,087 IT Pros & Developers. It's quick & easy.

Connection using ASP

P: 1
Hi,
I'm trying to use an asp page to send data from a basic HTML form to an Access database. I'm using GoDaddy hosting (which apparently many people have issues with when it comes to this) and here are my files:

form_ac.asp:
<%
' Declaring variables
Dim firstname, lastname, company, phone, email, data_source, con, SQLINSERT

' A Function to check if some field entered by user is empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function

' Receiving values from Form
firstname = ChkString(Request.Form("firstname"))
lastname = ChkString(Request.Form("lastname"))
company = ChkString(Request.Form("company"))
phone = ChkString(Request.Form("phone"))
email = ChkString(Request.Form("email"))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\hosting\trehomes\access_db\TREAgents.mdb ;"


SQLINSERT="INSERT INTO TRE1 (FirstName, LastName, Company, Phone, Email) "


SQLINSERT=SQLINSERT & "VALUES ("
SQLINSERT=SQLINSERT & "'" & firstname & "', "
SQLINSERT=SQLINSERT & "'" & lastname & "', "
SQLINSERT=SQLINSERT & "'" & company & "', "
SQLINSERT=SQLINSERT & phone & ", "
SQLINSERT=SQLINSERT & "'" & email & "') "


' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Mode = 3 '3 = adModeReadWrite
con.Open data_source
con.Execute SQLINSERT

' Done. Close the connection
con.Close
Set con = Nothing
%>

And the form code:

<form action="form_ac.asp" method="post">
First Name<br />
<input name="firstname" type="text" /><br />
Last Name<br />
<input name="lastname" type="text" /><br />
Company<br />
<input name="company" type="text" /><br />
Phone Number<br />
<input name="phone" type="text" /><br />
Email<br />
<input name="email" type="text" /><br />
<input type="submit" name="Submit" value="Submit">
</form>

However, I keep getting the following error:

Microsoft JET Database Engine error '80004005'

Operation must use an updateable query.

/form_ac2.asp, line 35

According to GoDaddy, once you enable access db's for the site, any databases saved in access_db folder should have the proper permissions set. I'm thinking something might be wrong with the connection? Any help is GREATLY appreciated!!
Nov 17 '08 #1
Share this Question
Share on Google+
1 Reply


missinglinq
Expert 2.5K+
P: 3,532
Since this concerns ASP code, with Access only providing the back end/data storage, I'm going to move it to the ASP forum, where it belongs.

Welcome to Bytes!

Linq ;0)>

Moderator
Nov 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.