macromedia.dreamweaver.appdev
[Top] [All Lists]

Advanced SQL builder not working

Subject: Advanced SQL builder not working
From: "Roflmeow"
Date: Mon, 4 Aug 2008 16:02:59 +0000 UTC
Newsgroups: macromedia.dreamweaver.appdev

Hi all, I'm a Network administrator put in charge of web development at our 
small company, and i am working on what should be a fairly simple application 
for management of a MSSQL database using ASP/Jscript.

 Using Dreamweaver CS3, i am for some reason unable to successfully build a 
search function for the database using the built in tools. 

 I have a page with 2 form entries, a list box with Column names (SearchBy), 
and a text field for the search terms(SearchFor).  I've tired several different 
incarnations using my limited knowledge of asp, and none will work right.

 I know the connection is solid and working. If i use static terms in the sql 
it brings everything up fine.

 Here is a copy of the Dreamweaver generated code that was built using the 
Advanced Recordset builder tool. Can anyone help point out what's going wrong?



 <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
 <!--#include file="../../../../Connections/assns.asp" -->
 <%
 var RS1__SearchBy = "ACCESSID";
 if (String(Request.Form("SearchBy")) != "undefined" && 
     String(Request.Form("SearchBy")) != "") { 
   RS1__SearchBy = String(Request.Form("SearchBy"));
 }
 %>
 <%
 var RS1__SearchFor = "Glennk";
 if (String(Request.Form("SearchFor")) != "undefined" && 
     String(Request.Form("SearchFor")) != "") { 
   RS1__SearchFor = String(Request.Form("SearchFor"));
 }
 %>
 <%
 var RS1_cmd = Server.CreateObject ("ADODB.Command");
 RS1_cmd.ActiveConnection = MM_assns_STRING;
 RS1_cmd.CommandText = "SELECT * FROM dbo.APPROVED WHERE ? = ?";
 RS1_cmd.Prepared = true;
 RS1_cmd.Parameters.Append(RS1_cmd.CreateParameter("param1", 200, 1, 255, 
RS1__SearchBy)); // adVarChar
 RS1_cmd.Parameters.Append(RS1_cmd.CreateParameter("param2", 200, 1, 255, 
RS1__SearchFor)); // adVarChar

 var RS1 = RS1_cmd.Execute();
 var RS1_numRows = 0;
 %>
 <%
 var Repeat1__numRows = 10;
 var Repeat1__index = 0;
 RS1_numRows += Repeat1__numRows;
 %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml";>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Untitled Document</title>
 </head>

 <body>
 <table border="1">
   <tr>
     <td>ACCESSID</td>
     <td>EXISTINGPORT</td>
     <td>AGREEMENTONFILE</td>
     <td>PRIMARYNAME</td>
     <td>EMAIL</td>
     <td>PHONE</td>
     <td>FAX</td>
     <td>FIRMNAME</td>
     <td>ADDRESS</td>
     <td>ADDRESS2</td>
     <td>CITY</td>
     <td>STATE</td>
     <td>ZIP</td>
   </tr>
   <% while ((Repeat1__numRows-- != 0) && (!RS1.EOF)) { %>
     <tr>
       <td><%=(RS1.Fields.Item("ACCESSID").Value)%></td>
       <td><%=(RS1.Fields.Item("EXISTINGPORT").Value)%></td>
       <td><%=(RS1.Fields.Item("AGREEMENTONFILE").Value)%></td>
       <td><%=(RS1.Fields.Item("PRIMARYNAME").Value)%></td>
       <td><%=(RS1.Fields.Item("EMAIL").Value)%></td>
       <td><%=(RS1.Fields.Item("PHONE").Value)%></td>
       <td><%=(RS1.Fields.Item("FAX").Value)%></td>
       <td><%=(RS1.Fields.Item("FIRMNAME").Value)%></td>
       <td><%=(RS1.Fields.Item("ADDRESS").Value)%></td>
       <td><%=(RS1.Fields.Item("ADDRESS2").Value)%></td>
       <td><%=(RS1.Fields.Item("CITY").Value)%></td>
       <td><%=(RS1.Fields.Item("STATE").Value)%></td>
       <td><%=(RS1.Fields.Item("ZIP").Value)%></td>
     </tr>
     <%
   Repeat1__index++;
   RS1.MoveNext();
 }
 %>
 </table>
 </body>
 </html>
 <%
 RS1.Close();
 %>


<Prev in Thread] Current Thread [Next in Thread>