jammer20002
09-02-2003, 06:51 PM
I'm really new to ASP.
I think I know the basics.
I need a script that takes value from a form and writes them to a database.
I also want some kind of response saying that the value had been successfully written tot he database.
I haven't a clue where to start.
Can anyone give me any sample scripts?
Thanks.
Jam
tuanyong
09-04-2003, 02:52 AM
<%
dim sDate, sTime, sSalesAm, sBrand, sCustomer, sDirNo, sContractStatus, sStartTime, sEndTime, sRemarks
sDate = Request.Form("date")
sTime = Request.Form("time")
sSalesAm = Request.Form("sales_am")
sBrand = Request.Form("brand")
sCustomer = Request.Form("customer")
sDirNo = Request.Form("directory_num")
sContractStatus = Request.Form("contract_status")
sStartTime = Request.Form("start_time")
sEndTime = Request.Form("end_time")
sRemarks = Request.Form("remarks")
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("booking.mdb")
stryourinsertstatement = "INSERT INTO appointmentDetails ([date], [time], sales_am, brand, customer, directory_num, contract_status, start_time, end_time, remarks ) VALUES('" & sDate & "', '" & sTime & "', '" & sSalesAM & "', '" & sBrand & "', '" & sCustomer & "', '" & sDirNo & "', '" & sContractStatus & "', '" & sStartTime & "', '" & sEndTime & "', '" & sRemarks & "')"
Set rsblah = Server.CreateObject("ADODB.Recordset")
rsblah.Open stryourinsertstatement, adoCon
adoCon.close
%>
This part of the script inserts records and stores them inside a database .
hope it will be of some help to you .
Cheers