Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Adding new records to MS Access

$
0
0
Hello

I have a MS Access database and a Web page, myData.asp, that displays the records in that database.

If possible, I would like - either on the same myData.asp page or on a separate Web page - an 'Insert' or 'Add' button with a number of blank fields for me to complete that, on clicking 'Submit', would add/insert the latest data.

The fields to be added to include Name, Address, City, etc.

I have the basic 'insert' code, as in:

Code:

<%
'declare your variables
dim connection, sSQL, sConnString

sSQL="INSERT INTO tblFriends (FirstName, Address) VALUES ('Michael', 'Wallgate Hall')"

sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Friends.mdb")

Set connection = Server.CreateObject("ADODB.Connection")

connection.Open(sConnString)

connection.execute(sSQL)

response.write "The data was inserted successfully."

Connection.Close
Set Connection = Nothing
%>

but this is applicable only when I know the values ('Michael', 'Wallgate Hall' in this example).

How would I add/insert other records to myData.asp (and therefore its corresponding MS Access database) using empty fields that I would need to complete and then click on 'Submit' when I do not know the field variables (Name, Address, etc) beforehand?

Many thanks for any advice.

Regards

Q

Viewing all articles
Browse latest Browse all 13329

Trending Articles