|
crosscreek -> RE: One more Hill (3/15/2008 12:19:22)
|
It's very helpful thank you...the seperation of the &Item will help when I try to seperate everything. I been working with the CASE statment & subroutines a little, because I think this will be easier to navigate through the page. My goal is the have someone type in a name in each of the seperate sire & dam text boxes in the parents.asp page From there list the dogs of the sire that matches (or give them the option to add the dog) They click on the hyperlink of the sire that matches, then the page reloads update the sire and then goes to the dam information. I can't seem to get the sub rountine to run the "Sub EditRecord (dogid)" part and retrieve the information I need or run the th initial code to show all the dogs that match (running the 1st step). I get a blank page... I'm doing this step by step, <%@ Language=VBScript %> <% 'option explicit%> <% Const Action_Add = "add" Const Action_View = "View" Const Action_Edit = "edit" %> <% 'sub main holds main loop Sub Main() Dim strAction 'deterime the action that was selected strAction = Request("action") Dim dogid, bolmatch If request.form("ID") <> " " then bolmatch = True dogid = (request.form("ID")) Response.write "this worked, but need to send to editrecord sub" End If If NOT bolmatch then Response.Write "error happened" End If Select Case strAction Case Action_Edit EditRecord dogid Case Else Response.Write "Error happend with case" End Select End Sub Sub EditRecord (dogid) Dim id, sires, dam, SireID, DamID, sSQL, SRSQL, SireSQL ID=request.form("dogid") SireID=request.form("sireID") sires=request.form("sires") DamID=request.form("damID") dam=request.form("dam") sSQL = "Update tbldog Set sireID = (0) WHERE ID= " & ID &"" Response.Write "DEBUG SQL: " & sSQL & "<HR>" ' remove when it works SRSQL = "SELECT 1 as ranking, tblDOG.ID AS dogID, tblDOG.name AS name, tblDOG.sireID AS SireID, Sire.name AS Sires, Sire.ID AS IDSire " _ & " FROM tblDOG LEFT JOIN tblDOG AS Sire ON tblDOG.sireID = Sire.ID WHERE tbldog.name = '" & sires & "' " _ & " UNION " _ & "SELECT 2 AS ranking, tblDOG.ID AS ID, tblDOG.name AS name, tblDOG.sireID AS SireID, Sire.name AS Sires, Sire.ID AS IDSire " _ & " FROM tblDOG LEFT JOIN tblDOG AS Sire ON tblDOG.sireID = Sire.ID WHERE tbldog.name LIKE '%" & sires & "%' " _ & "ORDER BY ranking, Sires" Response.Write "DEBUG SQL: " & SRSQL & "<HR>" ' remove when it works SireSQL = "UPDATE tblDOG LEFT JOIN tblDOG AS sire ON tblDOG.sireID = Sire.ID SET tblDOG.sireID = () WHERE sire.name =" & name & "" Response.Write "DEBUG SQL: " & SireSQL & "<HR>" ' remove when it works Dim objRS Set objRS = Server.CreateObject("ADODB.recordset") objRS.Open sSQL, myConn, , adLockOptimistic If Request.form("sires") = " " OR Request.form("sires") = "" THEN set objrs = myconn.execute(sSQL) Response.Write "DEBUG SQL: " & sSQL & "<HR>" ' remove when it works End If THERE'S MORE CODE BELOW, BUT DIDN'T REALLY SEE THE POINT OF POSTING IT.
|
|
|
|