The example from my page for getting records. <html> <head> <style> td { font-size : 9pt; font-family : Verdana, Arial; text-decoration : none; } body { font-size : 9pt; font-family : Verdana, Arial; text-decoration : none; } input { font-size : 9pt; font-family : Verdana, Arial; height : 17; } </style> </head> <body background=img/dot.gif> <%@ CODEPAGE = 1251%>
<% Sub AskForNumber() Response.Write ("Last records:<HR>") Response.Write ("<FORM ACTION = date_records.asp?mode=search METHOD = POST>") Response.Write ("Please, enter date: ") Response.Write ("<INPUT TYPE = TEXT NAME = txtDate>") Response.Write ("<INPUT TYPE = SUBMIT VALUE = ""Find"">") Response.Write ("</FORM>") End Sub Sub GetRecordsList()  im cn, rs, SearchString SearchString = Request.Form ("txtDate") If SearchString = "" Then Response.Redirect "date_records.asp" End If Set cn = Server.CreateObject ("ADODB.Connection") data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ Server.MapPath("db\find.mdb") cn.Open data_source sSQL = "SELECT * FROM find WHERE date_record > #" & SearchString & "# ORDER BY ID" Set rs = cn.Execute (sSQL) Response.Write ("<FORM ACTION = date_records.asp?mode=ask METHOD = POST>") Response.Write ("<TABLE BORDER=1><TR> ::Last records:: </TR><BR>") Response.Write ("<TR><TH>ID<TH>") Response.Write ("<TH>Name<TH>") Response.Write ("<TH>Place<TH>") Response.Write ("<TH>Birthday<TH>") Response.Write ("<TH>ate of aliya<TH>") Response.Write ("<TH>Last address<TH>") Response.Write ("<TH>Reason<TH>") While Not rs.EOF Response.Write ("<TR><TD>") Response.Write rs.Fields ("id") Response.Write ("<TD><TD>") Response.Write rs.Fields ("name") Response.Write ("<TD><TD>") Response.Write rs.Fields ("born") Response.Write ("<TD><TD>") Response.Write rs.Fields ("data") Response.Write ("<TD><TD>") Response.Write rs.Fields ("data_rep") Response.Write ("<TD><TD>") Response.Write rs.Fields ("address") Response.Write ("<TD><TD>") Response.Write rs.Fields ("prichina") Response.Write ("<TD><TR>") rs.MoveNext Wend Response.Write ("<INPUT TYPE = SUBMIT VALUE = ""Ask"">") Response.Write ("</FORM>") Response.Write ("Delete blank records:<HR>") Response.Write ("<FORM ACTION = date_records.asp?mode=delete METHOD = POST>") Response.Write ("<INPUT TYPE = SUBMIT VALUE = ""Delete"">") Response.Write ("</FORM>") Response.Write ("Delete record number: ") Response.Write ("<FORM action = date_records.asp?mode=delnum method=post>") Response.Write ("<INPUT TYPE = TEXT NAME = txtDELNUM>") 'Response.Write ("<INPUT TYPE = HIDDEN NAME = "mode" VALUE = "search">") Response.Write ("<INPUT TYPE = SUBMIT VALUE = ""DelNumber"">") Response.Write ("</FORM>") rs.Close cn.Close Set rs = Nothing Set cn = Nothing End Sub Sub DeleteBlankRecords()  im cn, rs Set cn = Server.CreateObject("ADODB.Connection") data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ Server.MapPath("db\find.mdb") cn.Open data_source sSQL = "DELETE * FROM find WHERE name = ''" Set rs = cn.Execute (sSQL) 'rs.Open 'rs.Save "C:\rs.txt" GetRecordsList End Sub Sub DeleteRecordNumber()  im cn, rs, RecNumber RecNumber = Request.Form ("txtDELNUM") If RecNumber = "" Then Response.Redirect "date_records.asp?mode=search" 'Exit Sub End If Set cn = Server.CreateObject ("ADODB.Connection") Set rs = Server.CreateObject ("ADODB.RecordSet") data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ Server.MapPath("db\find.mdb") cn.Open data_source sSQL = "DELETE * FROM find WHERE id = " & RecNumber Set rs = cn.Execute (sSQL) GetRecordsList End Sub Select Case Request.QueryString ("mode") Case "search" GetRecordsLIst Case "delete"  eleteBlankRecords Case "delnum"  eleteRecordNumber Case Else AskForNumber End Select %> </TABLE> </BODY> </HTML>
...but I am beginning in ASP.
Ответить
|