I'm working on a page where the user can search for the ID of a Agency they want to update, the Agency record will appear so it can be edited, and the user can submit those changes.
The code I have written thus far does not seem to work, and I am requesting some input to what could be wrong. I am still pretty new to ASP, and some of the code was inherited from a page made with Dreamweaver, hence the added code. There is much more to this form, but I have removed the extraneous fields to make it easier to troubleshoot.
The data is drawn from two different database, which is why there are two connection strings. Let me know if you need any more info.
The code I have written thus far does not seem to work, and I am requesting some input to what could be wrong. I am still pretty new to ASP, and some of the code was inherited from a page made with Dreamweaver, hence the added code. There is much more to this form, but I have removed the extraneous fields to make it easier to troubleshoot.
The data is drawn from two different database, which is why there are two connection strings. Let me know if you need any more info.
Code:
<%
qrySearchValue = Trim(Request("searchValue"))
strSearchValue = qrySearchValue
sqlProviders = "SELECT * FROM providers WHERE uid = '" & qrySearchValue & "' "
sqlAddlElements = "SELECT * FROM providers_addl_elements WHERE provider_id = '" & qrySearchValue & "' "
sqlUpdateAddlElements = "UPDATE providers_addl_elements SET common_name='"&request("common_name")&"' WHERE provider_id = '" & qrySearchValue & "' "
IF Request("Update")="Submit" THEN
rsAddlElements.Execute (sqlUpdateAddlElements)
END IF
Set rsProviders = Server.CreateObject("ADODB.Recordset")
rsProviders.ActiveConnection = MM_hmis_data_STRING
rsProviders.Source = sqlProviders
rsProviders.CursorType = 1
rsProviders.CursorLocation = 2
rsProviders.LockType = 1
rsProviders.Open()
rsProviders_numRows = 0
Set rsAddlElements = Server.CreateObject("ADODB.Recordset")
rsAddlElements.ActiveConnection = MM_coc_data_STRING
rsAddlElements.Source = sqlAddlElements
rsAddlElements.CursorType = 1
rsAddlElements.CursorLocation = 2
rsAddlElements.LockType = 1
rsAddlElements.Open()
rsAddlElements_numRows = 0
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsProviders_numRows = rsProviders_numRows + Repeat1__numRows
%>
<form name="Search" method="get">
<% if strSearchValue = "" then strSearchValue = "" %>
<strong>Provider ID:</strong>
<input type="text" name="searchValue" value="<%=strSearchValue%>">
<input type="submit" id="Search" name="Search" value="Search">
</form>
<% if rsProviders.EOF then Response.Write "<strong>Sorry, no results found." end if %>
<% if qrySearchValue <> "" then
While ((Repeat1__numRows <> 0) AND (NOT rsProviders.EOF)) %>
<form name="Update" method="post" enctype="multipart/form-data">
<label for="provider_name">Provider Name: </label><input type="text" name="name" id="name" value="<%=(rsProviders.Fields.Item("name").Value)%>" /><br>
<label for="common_name">Common Name: </label><input type="text" name="common_name" id="common_name" value="<%=(rsAddlElements.Fields.Item("common_name").Value)%>" /><br>
<input type="submit" id="Update" name="Update" value="Update Record">
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsProviders.MoveNext()
wend
end if
%>
</form>
<%
rsProviders.Close()
Set rsProviders = Nothing
rsAddlElements.Close()
Set rsAddlElements = Nothing
%>