<%@ Language=VBScript %>
<%
Response.Expires = 0

'Kein Resultat

If Len(Request.Form("fldnachname")) < 1 Then 
  Response.Redirect "uebung09a_suchform.asp"
End If

Dim objcon, objrs, strsql
Set objcon = Server.CreateObject("ADODB.Connection")
'ODBC on the fly
objcon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & _
  "DBQ=" & Server.MapPath("/asppages/silvi/db/dbpersonen2000.mdb")

Set objrs = Server.CreateObject("ADODB.Recordset")
'nachname kommt aus Formularfeld
strsql = "SELECT * FROM tblpersonen WHERE nachname = '" & _
  Request.Form("fldnachname") & "'"
'Recordset für objrs.RecordCount scrollbar sein, deshalb 1 
objrs.Open strsql, objcon, 1

if objrs.RecordCount <> 1 Then
  Response.Redirect "uebung09a_suchform.asp"
End If

%>

<html>
  <head>
    <title>SWP-Einführung ASP 2: Formular zum Updaten von Datensätzen</title>
  </head>

<body>

<form method="post" action="uebung09c_update.asp">
  <p>Füllen Sie bitte die folgenden Felder aus:</p>
  <table border="0">
    <tr>
      <td>Nachname</td>
      <td><input type="hidden" name="fldpersonennr"  
           value="<%=objrs("personennr")%>" />

          <input type="text" name="fldnachname" size="25" 
           value="<%=objrs("nachname")%>" />

      </td>
    </tr>
    <tr>
      <td>Vorname</td>
      <td><input type="text" name="fldvorname" size="25"
           value="<%=objrs("vorname")%>" />

      </td>
    </tr>
    <tr>
      <td>Jahrgang</td>
      <td><input type="text" name="fldjahrgang" size="25"
           value="<%=objrs("jahrgang")%>" />

      </td>
    </tr>
  </table>
  <p><input type="submit" value="Abschicken" name="btnsubmit"></p>
</form>

</body>

</html>


Letzter Update: 26.12.2021 17:48

Zurück zur Liste mit ASP-Übungen auf  www.ecotronics.ch