473,412 Members | 3,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

help please on insert statement into Access from webpage !

hi,

i am trying to write records from an ASPX page to a access database, but get
an error on my insert statement, but not on a select statement. please let me
know if you can see what i'm doing wrong, code is below:

strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
strCompanyName = Request.Form("CompanyName")
strTelephone = Request.Form("Telephone")
strFAX = Request.Form("FAX")
strStreetAddress = Request.Form("StreetAddress")
strCity = Request.Form("City")
strStateProvince = Request.Form("StateProvince")
strZipPostalCode = Request.Form("ZipPostalCode")
strUsername = Request.Form("Username")
strPassword = Request.Form("Password")

curDir = Server.MapPath("\registrationdb.mdb")

set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
"C:\RegistrationDB.mdb" & ";"
Set oRs = Server.CreateObject("ADODB.Recordset")
Set oRs.ActiveConnection = oConn
oRs.Source = "INSERT INTO tblCustomerInfo (FirstName, LastName,
CompanyName, Telephone, FAX, StreetAddress, City, StateProvince,
ZipPostalCode, Username, Password) VALUES ('" & strFirstName & "', '" &
strLastName & "', '" & strCompanyName & "', '" & strTelephone & "', '" &
strFAX & "', '" & strStreetAddress & "', '" & strCity & "', '" &
strStateProvince & "', '" & strZipPostalCode & "', '" & strUsername & "', '"
& strPassword & "')"
oRs.Open

Nov 19 '05 #1
1 1444
Hi Lee Holsenbeck,

It might be a security problem.

In order to Insert/Update Access database, in addition
to 'Read' permission, you should also give 'Write'
permission of the db file to the ASPNET account.
HTH

Elton Wang
el********@hotmail.com

-----Original Message-----
hi,

i am trying to write records from an ASPX page to a access database, but getan error on my insert statement, but not on a select statement. please let meknow if you can see what i'm doing wrong, code is below:

strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
strCompanyName = Request.Form("CompanyName")
strTelephone = Request.Form("Telephone")
strFAX = Request.Form("FAX")
strStreetAddress = Request.Form("StreetAddress")
strCity = Request.Form("City")
strStateProvince = Request.Form("StateProvince")
strZipPostalCode = Request.Form("ZipPostalCode")
strUsername = Request.Form("Username")
strPassword = Request.Form("Password")

curDir = Server.MapPath("\registrationdb.mdb")

set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &"C:\RegistrationDB.mdb" & ";"
Set oRs = Server.CreateObject("ADODB.Recordset")
Set oRs.ActiveConnection = oConn
oRs.Source = "INSERT INTO tblCustomerInfo (FirstName, LastName,CompanyName, Telephone, FAX, StreetAddress, City, StateProvince,ZipPostalCode, Username, Password) VALUES ('" & strFirstName & "', '" &strLastName & "', '" & strCompanyName & "', '" & strTelephone & "', '" &strFAX & "', '" & strStreetAddress & "', '" & strCity & "', '" &strStateProvince & "', '" & strZipPostalCode & "', '" & strUsername & "', '"& strPassword & "')"
oRs.Open

.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: duikboot | last post by:
Hi all, I'm trying to export a view tables from a Oracle database to a Mysql database. I create insert statements (they look alright), but it all goes wrong when I try to execute them in Mysql,...
7
by: Bill Kellaway | last post by:
Hi there - this should be fairly simple for someone. Basically I can't figure out how to pass the parameters from ASP to a Stored Procedure on SQL. Here's my code: I just need to help in...
2
by: TeleTech | last post by:
Hi. Please try to bear with this SQL "newbie" here ;) I am trying to figure out how to import the FCC ULS report results into a database. I believe what I need is a JOIN statement. To see...
1
by: Joe | last post by:
Hello All, I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message, System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. ...
28
by: Siv | last post by:
Hi, If I run the following: strSQL = "Select * FROM Clients;" da = New OleDb.OleDbDataAdapter(strSQL, Conn) 'Create data adapter cb = New OleDb.OleDbCommandBuilder(da) ...
1
by: David | last post by:
Hi, I cannot get the following (MS Access) SQL statement working in my asp page, please can anyone help me ? Thanks :-) ------------------------------------------------ <% strQuery =...
7
by: Materialised | last post by:
Hi Folks, Just a quickie, I am inserting some records (individually) into a SQL Server Table. I am wondering how can I detect primary key violations on this data which I am inserting into the...
16
by: Sam Durai | last post by:
Hello, I need to merge a small table (of rows less than 100,sometimes even 0 rows) to a big table (of rows around 4 billion). I used the PK of the big table as merge key but merge does a table scan...
0
by: LanaR | last post by:
Hello, one sql statement is causing severe performance issue. The problem occurs only in UDB environment, the same statemnt on the mainframe is running fine. I have an explain output from the sql....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.