Skip to main content
Participant
October 6, 2006
Question

ASP.Net SQL parameter operator

  • October 6, 2006
  • 1 reply
  • 247 views


I am trying to display results from a SQL query based on a selection from a listbox on a form. I am to display the results if I use the "Like" parameter in SQL but not if I change it to "=". Here is my code....please, please help:

This topic has been closed for replies.

1 reply

Inspiring
October 9, 2006
Wildcard characters only work when used in a LIKE character and not with an
= as you have found out the hard way.

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"joannek333" <webforumsuser@macromedia.com> wrote in message
news:eg6otb$4lo$1@forums.macromedia.com...
>
>
> I am trying to display results from a SQL query based on a selection from
> a
> listbox on a form. I am to display the results if I use the "Like"
> parameter in
> SQL but not if I change it to "=". Here is my code....please, please help:
>
>
>
> <%@ Page Language="VB" ContentType="text/html"
> ResponseEncoding="iso-8859-1" %>
> <%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls"
> Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,cultu
> re=neutral" %>
> <MM:DataSet
> id="DataSet1"
> runat="Server"
> IsStoredProcedure="false"
> ConnectionString='<%#
> System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_CPA
> R") %>'
> DatabaseType='<%#
> System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETY
> PE_CPAR") %>'
> CommandText='<%# "SELECT ""ISO 9001 Clause"", ""Action To:"",
> ""Description of
> Nonconformity"", ""Verified By"", ""Submission Date"", ""Completion
> Date"",
> ""Verification Date"", ""Reference Document"", ""Process Owner"", Remarks
> FROM
> dbo.ListofNonconformities WHERE ""Reference Document"" = ?" %>'
> PageSize="10"
> Debug="true"
> >
> <Parameters>
> <Parameter Name="@Reference Document" Value='<%# "%" +
> (IIf((Request.Form("fmjo") <> Nothing), Request.Form("fmjo"), "")) + "%"
> %>'
> Type="VarWChar" /></Parameters></MM:DataSet>
> <MM:PageBind runat="server" PostBackBind="true" />
> <!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=iso-8859-1" />
> <title>Untitled Document</title>
> </head>
> <body>
> <form action="" method="post" name="fjo" target="_self" id="fjo"
> runat="server">
> <p>
> <asp:ListBox ID="ListBox1" runat="server" name="ListBox"
> SelectionMode="multiple" DataSource="<%# DataSet1.DefaultView %>"
> DataTextField="Reference Document" DataValueField="Reference
> Document"></asp:ListBox>
> <asp:Button ID="Submit" Text="Submit" runat="server" />
> </p>
> <p>
> <asp:DataGrid
> AllowCustomPaging="true"
> AllowPaging="true" AutoGenerateColumns="True"
> CellPadding="3"
> CellSpacing="0"
> DataSource="<%# DataSet1.DefaultView %>" ID="DataGrid1"
> PagerStyle-Mode="NextPrev"
> PageSize="<%# DataSet1.PageSize %>"
> runat="server"
> ShowFooter="false"
> ShowHeader="true"
> OnPageIndexChanged="DataSet1.OnDataGridPageIndexChanged"
> virtualitemcount="<%# DataSet1.RecordCount %>"
> >
> <headerstyle HorizontalAlign="center" BackColor="#E8EBFD"
> ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif"
> Font-Bold="true" Font-Size="smaller" />
> <itemstyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica,
> sans-serif" Font-Size="smaller" />
> <alternatingitemstyle BackColor="#E5E5E5" Font-Name="Verdana, Arial,
> Helvetica, sans-serif" Font-Size="smaller" />
> <footerstyle HorizontalAlign="center" BackColor="#E8EBFD"
> ForeColor="#3D3DB6"
> Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true"
> Font-Size="smaller" />
> <pagerstyle BackColor="white" Font-Name="Verdana, Arial, Helvetica,
> sans-serif" Font-Size="smaller" />
> <columns>
> <asp:BoundColumn DataField="ISO 9001 Clause"
> HeaderText="ISO 9001 Clause"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Action To:"
> HeaderText="Action To:"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Description of Nonconformity"
> HeaderText="Description of Nonconformity"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Verified By"
> HeaderText="Verified By"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Submission Date"
> HeaderText="Submission Date"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Completion Date"
> HeaderText="Completion Date"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Verification Date"
> HeaderText="Verification Date"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Reference Document"
> HeaderText="Reference Document"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Process Owner"
> HeaderText="Process Owner"
> ReadOnly="true"
> Visible="True"/>
> <asp:BoundColumn DataField="Remarks"
> HeaderText="Remarks"
> ReadOnly="true"
> Visible="True"/>
> </columns>
> </asp:DataGrid>
> </p>
> </form>
> </body>
> </html>
>