[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

ASP Write Multiple Rows to Access Database

Asked by ChrisDenny in Active Server Pages (ASP)

Tags: 65064, asp, form, multiple, rows

Problem:  I need to write data to an access database.  Each line has a "CheckBox" in front of it and for those that I "Check", I need to write to the database.  Each row must be written in the database seperately.

Bad Explanation:  I read from the ""SMS Machines at all Sites"" access database, specific rows that I need (an asp file).  I put a "Check Box" in front of each row during the import to my form.  I then want to check each row that I want to submit to read those specific "CheckBox" rows into a "Results" access Database.  However, all fields are being written in one row.  I need to seperate each row and write each row one at a time

Source Code:  Here is my complete code.  I am using FrontPage (which doesn't have any good references as for as I can see) on the creation of this:

<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
      Err.Clear

      Set fp_conn =  Server.CreateObject("ADODB.Connection")
      FP_DumpError strErrorUrl, "Cannot create connection"

      Set fp_rs = Server.CreateObject("ADODB.Recordset")
      FP_DumpError strErrorUrl, "Cannot create record set"

      fp_conn.Open Application("appdetailssms_ConnectionString")
      FP_DumpError strErrorUrl, "Cannot open database"

      fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
      FP_DumpError strErrorUrl, "Cannot open record set"

      fp_rs.AddNew
      FP_DumpError strErrorUrl, "Cannot add new record set to the database"
      Dim arFormFields0(1)
      Dim arFormDBFields0(1)
      Dim arFormValues0(1)

      arFormFields0(0) = "myChoice1"
      arFormDBFields0(0) = "myChoice1"
      arFormValues0(0) = Request("myChoice1")

      FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

      If Request.ServerVariables("REMOTE_HOST") <> "" Then
            FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"), "Remote_computer_name"
      End If
      FP_SaveFieldToDB fp_rs, Now, "Timestamp"
      If Request.ServerVariables("REMOTE_USER") <> "" Then
            FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"), "User_name"
      End If

      fp_rs.Update
      FP_DumpError strErrorUrl, "Cannot update the database"

      fp_rs.Close
      fp_conn.Close

      FP_FormConfirmation "text/html; charset=windows-1252",_
                                    "Form Confirmation",_
                                    "Thank you for submitting the following information:",_
                                    "appdetailssms.asp",_
                                    "Return to the form."

End If
End If

%>
<%
Survey=Request.Cookies("DCSITMDEWEBPAGE")
Response.Write(Session(Name))

%>
<HTML>
<HEAD>
<TITLE>prtnav</TITLE>
<base target="_self">
<style fprolloverstyle>A:hover {color: #FF0000; font-family: Arial; font-size: 12pt}
</style>
</HEAD>
<BODY bgcolor="#FFFFFF">
<!-- URL's used in the movie-->
<!-- URL's used in the movie-->
<table border="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
  <thead>
  </thead>
  <tbody>
    </tbody>
</table>
<form method="POST" action="--WEBBOT-SELF--" name="SMSSubMit">
  <!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="../../_fpclass/fpdbform.inc" s-dataconnection="DCSAPPS1" s-recordsource="Results" u-database-url="../../fpdb/WEB.mdb" s-builtin-fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER" s-builtin-dbfields="Browser_type Remote_computer_name Timestamp User_name" s-form-fields="A1 A2 A3 A4 MyChoice1" s-form-dbfields="A1 A2 A3 A4 myChoice1" -->
  <table width="100%" border="1">
    <tbody>
      <!--webbot bot="DatabaseRegionStart" s-columnnames="SiteCode,Name0,UserName0,Caption0,Remote_computer_name,User_name,Browser_type,Timestamp,Name,General_Description,Department,Field4,Field5,Distribution_Method,Field7,Version,Field9,Field10,Field11,Field12,Field13,Wise_Job_Deployment_Location,Field15,Field16,Field17,Field18,Field19,Field20,Field21,Field22,Field23,Field24,Field25,Field26,Field27,Field28,Field29,Field30,Field31,Field32,Field33,Field34,Field35,Field36,Field37,Field38,Field39,Field40" s-columntypes="202,202,202,202,202,202,202,135,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202" s-dataconnection="DCSAPPS1" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice="Caption0" s-menuvalue="Caption0" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="SiteCode,Name0,UserName0,Caption0,Name,Version" s-criteria s-order s-sql="SELECT Distinct V1.*, V2.*&lt;br&gt;FROM &amp;quot;SMS Machines at all Sites&amp;quot; V1, &amp;quot;DCS_Desktop_Engineering&amp;quot; V2&lt;br&gt;WHERE V1.SiteCode =  '::Department::'&lt;br&gt;AND V2.Name = '::Name::'&lt;br&gt;AND V2.Version = '::Version::'&lt;br&gt;AND V1.UserName0 &amp;lt;&amp;gt; 'NULL'&lt;br&gt;AND V1.Name0 &amp;lt;&amp;gt; 'NULL'&lt;br&gt;AND V2.Field11 = 'Win2000'&lt;br&gt;AND V2.Field7 = 'DCX Developed'&lt;br&gt;" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="Department=&amp;amp;Name=&amp;amp;Version=" s-norecordsfound="Automated Distribution is currently not available for this application" i-maxrecords="0" i-groupsize="0" botid="4" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan b-InForm="TRUE" b-WasTableFormat="TRUE" b-ReplaceDatabaseRegion="FALSE" --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT Distinct V1.*, V2.* FROM ""SMS Machines at all Sites"" V1, ""DCS_Desktop_Engineering"" V2 WHERE V1.SiteCode =  '::Department::' AND V2.Name = '::Name::' AND V2.Version = '::Version::' AND V1.UserName0 <> 'NULL' AND V1.Name0 <> 'NULL' AND V2.Field11 = 'Win2000' AND V2.Field7 = 'DCX Developed' "
fp_sDefault="Department=&Name=&Version="
fp_sNoRecords="<tr><td colspan=6 align=left width=""100%"">Automated Distribution is currently not available for this application</td></tr>"
fp_sDataConn="DCSAPPS1"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="Caption0"
fp_sMenuValue="Caption0"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=4
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-CheckSum="55711" --><tr>
        <td>
        <INPUT type=checkbox name=MyChoice1 value="<%=FP_FieldVal(fp_rs,"Name0")%>,<%=FP_FieldVal(fp_rs,"Caption0")%>,<%=FP_FieldVal(fp_rs,"Name0")%>,<%=FP_FieldVal(fp_rs,"UserName0")%>,<%=FP_FieldVal(fp_rs,"Name")%>  <%=FP_FieldVal(fp_rs,"Version")%>"></td>
        <td>
        <input type="text" name=A1 size="35" value="<%=FP_FieldVal(fp_rs,"Caption0")%>"></td>
        <td>
        <input type="text" name=A2 size="17" value="<%=FP_FieldVal(fp_rs,"Name0")%>"></td>
        <td>
        <input type="text" name=A3 size="12" value="<%=FP_FieldVal(fp_rs,"UserName0")%>"></td>
        <td>
        <input type="text" name=A4 size="20" value="<%=FP_FieldVal(fp_rs,"Name")%><%=FP_FieldVal(fp_rs,"Version")%>">  </td>
      </tr>
      <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-CheckSum="65064" --></tbody>
</table>
 
  <p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<p align="center"> </p>
<p align="center"><a href="javascript:history.back();"><font face="Arial">BACK</font></a></p>

<pre></pre>

</BODY>
</HTML>

I did my best to understand the posting at but just couldn't apply it due to my lack of knowledge in this: http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20185284.html

You assistance would be with much appreciation.  

Thanks in advance,

Christopher Denny
[+][-]03/11/03 08:10 AM, ID: 8112085Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Server Pages (ASP)
Tags: 65064, asp, form, multiple, rows
Sign Up Now!
Solution Provided By: ChrisDenny
Participating Experts: 4
Solution Grade: A
 
[+][-]02/01/03 08:19 PM, ID: 7861550Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/01/03 09:34 PM, ID: 7861765Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/01/03 09:36 PM, ID: 7861769Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/02/03 01:13 AM, ID: 7862111Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/02/03 01:14 AM, ID: 7862113Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/02/03 06:31 AM, ID: 7862686Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/03/03 08:20 PM, ID: 7872432Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/03/03 09:19 PM, ID: 7872684Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/09/03 06:46 PM, ID: 7915072Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/03 06:30 PM, ID: 7991203Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/21/03 04:25 PM, ID: 7996468Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 11:00 AM, ID: 8927631Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/06/03 04:16 PM, ID: 9095526Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92