hughesmi
11-16-2004, 10:48 AM
Ha all.
I'm try to update my two tables "Name" and "Reason" I have got the sql doing that. But I can't get Name to match the ID in the Reason table.
So I guess what I'm asking is how to I set the ID specify for the name?
<%
Dim adoCon
Dim rsAddName
Dim rsAddReason
Dim strSQL1
Dim strSQL2
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
Set rsAddName = Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT Name.Name FROM Name"
rsAddName.CursorType = 2
rsAddName.LockType = 2
rsAddName.Open strSQL1, adoCon
rsAddName.AddNew
rsAddName.Fields("Name") = Request.Form("Name")
rsAddName.Update
rsAddName.Close
Set rsAddName = Nothing
Set rsAddReason = Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT Reason.Early, Reason.Late, Reason.Date FROM Reason"
rsAddReason.CursorType = 2
rsAddReason.LockType = 2
rsAddReason.Open strSQL2, adoCon
rsAddReason.AddNew
rsAddReason.Fields("Early") = Request.Form("Early")
rsAddReason.Fields("Late") = Request.Form("Late")
rsAddReason.Fields("Date") = now
rsAddReason.Update
rsAddReason.Close
Set rsAddReason = Nothing
Set adoCon = Nothing
Response.Redirect "form.asp"
%>
I'm try to update my two tables "Name" and "Reason" I have got the sql doing that. But I can't get Name to match the ID in the Reason table.
So I guess what I'm asking is how to I set the ID specify for the name?
<%
Dim adoCon
Dim rsAddName
Dim rsAddReason
Dim strSQL1
Dim strSQL2
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
Set rsAddName = Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT Name.Name FROM Name"
rsAddName.CursorType = 2
rsAddName.LockType = 2
rsAddName.Open strSQL1, adoCon
rsAddName.AddNew
rsAddName.Fields("Name") = Request.Form("Name")
rsAddName.Update
rsAddName.Close
Set rsAddName = Nothing
Set rsAddReason = Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT Reason.Early, Reason.Late, Reason.Date FROM Reason"
rsAddReason.CursorType = 2
rsAddReason.LockType = 2
rsAddReason.Open strSQL2, adoCon
rsAddReason.AddNew
rsAddReason.Fields("Early") = Request.Form("Early")
rsAddReason.Fields("Late") = Request.Form("Late")
rsAddReason.Fields("Date") = now
rsAddReason.Update
rsAddReason.Close
Set rsAddReason = Nothing
Set adoCon = Nothing
Response.Redirect "form.asp"
%>