Using an array to implement database records in the ASP

zhaozj2021-02-16  52

Use an array to implement a batch entry method for database records (original)

Demo: http://www.zwtd.com/1/yanek/n/needdj2.asp

<%

REM Article Title ASP Using Arranges to Implement Database Record (Original)

Author: yanek

Contact Email: askBOY@263.net

%>

Includes two files 1. Allneeddj.asp: Realize the generation of form 2. AllneedDjresult.asp Processing Table Single Bigs Extraction 3.Hbedu.mdb: Database files The database structure is as follows: province Numeric DytaOCount: Number value type PapertaoCount: Patty Set Numeric CpContent: out Slice content value type filename: file name text type beizhu: Remarks Remarks

This example is recorded in 10 records, and 6 fields are recorded.

1. Allneeddj.asp

Requirements </ Title> </ head></p> <p><body></p> <p><% set conn = server.createObject ("adoDb.connection" conn.open "driver = {microsoft access driver (* .mdb)}; dbq =" & _server.mappath ("hbedu.mdb")</p> <p>%></p> <p><form method = "post" action = "allneddjresult.asp"> <div align = "center"> <center> <table border = "1" width = "700" bordercolorlight = "# fff"> <tr> <TD Width = "660" colspan = "6"> <p align = "center"> Requirements case </ td> </ tr> <tr> <td width = "54" align = "center"> province </ td> <td width = "66" align = "center"> Digital number of pads </ TD> <TD width = "66" align = "center"> Patty number of sheets </ TD> <TD width = "66" align = " CENTER> Captive content </ td> <td width = "80" align = "center"> file name </ td> <td width = "328" align = "center"> <p align = "center"> Remarks </ TD> </ TR> <% REM Generates Different Names Field for i = 1 to 10%> <% SET RS = Server.createObject ("AdoDb.Recordset") SQL = "Select * from proVinceinfo "RS.Open SQL, CONN, 1, 1</p> <p>SET RS1 = Server.createObject ("AdoDb.Recordset") SQL1 = "Select * from filename" RS1.Open SQL1, CONN, 1, 1%> <TR> <TD Width = "54"> <select name = "< % response.write "DATA1" & I%> "size =" 1 "> <% do while not rs.eofif province = cstr (RS (" ID ")) THENSEL =" SELECTED "Elsesel =" End if Response.write "<option" & SEL & "Value = '" CSTR (RS ("ID")) "" "" rs ("province") "</ option>" chr (13) CHR (10 rs.movenextloopset = Nothing%> </ select> </ td> <td width = "66"> <input type = "name =" <% response.write "data" & I%> "size =" 8 "> </ td> <TD width =" 66 "> <input type =" text "name =" <% response.write "data3" & i%> "size =" 8 "> </ td> <TD Width = "66"> <select size = "1" name = "<% response.write" DATA4 "& I%>"> <option value = "1"> CD section </ option> <option value = "2"> All content </ option> </ select> </ td> <td width = "80"> <select name = "<% response.write" data5 "& i%>" size = "1"> <% do while not Rs1.eofif filename = CSTR (RS1 ("FileName")) THENSEL = "SELECTED" Elsesel = "" End if Response.write "<option" & SEL & "Value = '" CSTR (RS1 ("FileName"))) "'>" RS1 ("filename") "</ option>" </p> <p>CHR (13) CHR (10) rs1.movenextLoopSet RS1 = Nothing%> </ select> </ td> <td width = "328"> <textarea rows = "2" Name = "<% response.write" Data6 "& I%>" cols = "46"> </ textarea> </ td> </ tr> <% next%> <tr> <td width = "660" colSpan = "6"> <p align = "center "> <input type =" submit "value =" Submit "Name =" B1 "> </ td> </ tr> </ table> </ center> </ div> </ form> </ body></p> <p></ html></p> <p>2.allneeddjresult.asp</p> <p><% REM Defines the value of the 2D number of groups from the form acquired DIM DATA (10, 6) for i = 1 to 6for J = 1 to 10myData = "DATA" CSTR (i) CSTR (J) Data (J, I ) = Request.form (MyData) NextNext%></p> <p><% REM output form input value for i = 1 to 10for J = 1 to 6</p> <p>Response.write Data (i, j)</p> <p>NextResponse.write "<br>" Next</p> <p>'response.end%></p> <p><% DIM CONN, RSSET CONN = Server.createObject ("AdoDb.Connection" Conn.open "Driver = {Microsoft Access Driver (* .mdb)}; DBQ =" & _Server.mappath ("hbedu.mdb")</p> <p>For i = 1 to 10REM cycle batch storage</p> <p>SET RS = Server.createObject ("AdoDb.Recordset") RS.Open "hbedu", conn, 1, 3rs.addnewrs ("beiz") = DATA (I, 6) rs ("filename") = data (i, 5) RS ("CPContent") = DATA (I, 4) = DATA (I, 3) rs ("Dytaocount") = DATA (i, 2) rs ("provinceId") = data ( I, 1) rs.Updaters.closset RS = Nothing</p> <p>Response.write "OK <br>" Next%> Demo: http://www.zwtd.com/1/yanek/n/needdj2.asp</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-23958.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="23958" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.031</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '7YQjsEjz_2FqUdfTfEAbhemE5C9dD29TjmdT21eazL_2FuMMh2H_2BJDEdVeKT_2BDFIKwttmdaDLFFUurSHO64u4mOWSA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>