selectcommand table variable

I have users open a url link that passes var to a webpage which in turn runs a select statement against my sql server.  working great. See code.

The url is http://Mywebsite.com/Pagename.aspx?Leasenum=03011870?TableName=TableVariable

i want the From Tablename substituted with the tablename  variable  in the url.

THank you
<asp:SqlDataSource ID="Boutlist" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Connstring %>"             
        
        
        SelectCommand="SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name
        , [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices
        , [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due
         FROM [Tablename] WHERE ([Lease] = @Lease)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Lease" QueryStringField="Leasenum" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>

Open in new window

acardulloSystems Administrator. DBAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hawks4everCommented:
I would think the easiest way would be to move your SelectCommand to your code file:

Boutlist.SelectCommand = "SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name
        , [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices
        , [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due
         FROM " + Request.QueryString["TableName"] + " WHERE ([Lease] = @Lease)"
0
acardulloSystems Administrator. DBAAuthor Commented:
easy if you know how to do that. i ' don's so walk me thorugh it.  what do i remove from the main page and hopw and what do i put in the code page?
0
acardulloSystems Administrator. DBAAuthor Commented:
This is my code page

and below is my aspx page

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NewEngland.aspx.vb" Inherits="BuyoutPage" %>

<!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 runat="server">
    <title></title>
    <style type="text/css">
        .style2
        {
            height: 551px;
        }
        .style3
        {
            height: 25px;
            width: 76px;
        }
    </style>
   
</head>
<body>


    <form id="form1" runat="server" class="style2">
    <div>
   
        &nbsp;<br />
         
        <br />
       
   
        <asp:DataList ID="DataList1" runat="server" DataSourceID="Boutlist"
            Height="228px" RepeatDirection="Horizontal" style="margin-top: 50px"
            Width="520px">
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left"
                VerticalAlign="Top" />
            <ItemTemplate>
                Status:
                <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' />
                <br />
                Lease:
                <asp:Label ID="LeaseLabel" runat="server" Text='<%# Eval("Lease") %>' />
                <br />
                End_Date:
                <asp:Label ID="End_DateLabel" runat="server"
                    Text='<%# Eval("End_Date") %>' />
                <br />
                Customer_Name:
                <asp:Label ID="Customer_NameLabel" runat="server"
                    Text='<%# Eval("Customer_Name") %>' />
                <br />
                Trade_Up:
                <asp:Label ID="Trade_UpLabel" runat="server"
                    Text='<%# Eval("Trade_Up") %>' />
                <br />
                Past_Due_Invoices:
                <asp:Label ID="Past_Due_InvoicesLabel" runat="server"
                    Text='<%# Eval("Past_Due_Invoices") %>' />
                <br />
                FF_Start:
                <asp:Label ID="FF_StartLabel" runat="server" Text='<%# Eval("FF_Start") %>' />
                <br />
                FF_End:
                <asp:Label ID="FF_EndLabel" runat="server"
                    Text='<%# Eval("FF_End") %>' />
                <br />
                Fast_Forward_Past_Due:
                <asp:Label ID="Fast_Forward_Past_DueLabel" runat="server"
                    Text='<%# Eval("Fast_Forward_Past_Due") %>' />
                <br />
                <br />
            </ItemTemplate>
        </asp:DataList>
        <br />
        <asp:TextBox ID="TextBox1" runat="server" Font-Size="Small"
            Height="33px" Width="534px" BorderStyle="None" Font-Bold="True">All past due amounts need to be added to the Trade up Amount!</asp:TextBox>
   
        <br />
        <asp:TextBox ID="TextBox2" runat="server" Font-Size="Small" Width="914px"
            BorderStyle="None" Font-Bold="True">These figures are estimates and any written order will need to be accompanied by an official trade up quote from MailFinance.</asp:TextBox>
   
        <br />
        <br />
   
        <br />
   
    </div>
       
        <asp:SqlDataSource ID="Boutlist" runat="server"
            ConnectionString="<%$ ConnectionStrings:NewEnglandBO %>"
           
                 
       
        SelectCommand="SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name
        , [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices
        , [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due
         FROM [tbl_NewEnglandBO] WHERE ([Lease] = @Lease)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Lease" QueryStringField="Leasenum"
                    Type="String" />
                    <asp:QueryStringParameter Name="table" QueryStringField="Tablename"
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    &nbsp;<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"
        class="style3"></form>
</body>
</html>

Partial Class BuyoutPage
    Inherits System.Web.UI.Page

    Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class

Open in new window

0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

hawks4everCommented:
I'm assuming the DataList is being bound on page load.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NewEngland.aspx.vb" Inherits="BuyoutPage" %>

<!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 id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        .style2
        {
            height: 551px;
        }
        .style3
        {
            height: 25px;
            width: 76px;
        }
    </style>
   
</head>
<body>


    <form id="form1" runat="server" class="style2">
    <div>
   
        &nbsp;<br />
         
        <br />
       
   
        <asp:DataList ID="DataList1" runat="server" DataSourceID="Boutlist"
            Height="228px" RepeatDirection="Horizontal" style="margin-top: 50px"
            Width="520px">
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left"
                VerticalAlign="Top" />
            <ItemTemplate>
                Status:
                <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' />
                <br />
                Lease:
                <asp:Label ID="LeaseLabel" runat="server" Text='<%# Eval("Lease") %>' />
                <br />
                End_Date:
                <asp:Label ID="End_DateLabel" runat="server"
                    Text='<%# Eval("End_Date") %>' />
                <br />
                Customer_Name:
                <asp:Label ID="Customer_NameLabel" runat="server"
                    Text='<%# Eval("Customer_Name") %>' />
                <br />
                Trade_Up:
                <asp:Label ID="Trade_UpLabel" runat="server"
                    Text='<%# Eval("Trade_Up") %>' />
                <br />
                Past_Due_Invoices:
                <asp:Label ID="Past_Due_InvoicesLabel" runat="server"
                    Text='<%# Eval("Past_Due_Invoices") %>' />
                <br />
                FF_Start:
                <asp:Label ID="FF_StartLabel" runat="server" Text='<%# Eval("FF_Start") %>' />
                <br />
                FF_End:
                <asp:Label ID="FF_EndLabel" runat="server"
                    Text='<%# Eval("FF_End") %>' />
                <br />
                Fast_Forward_Past_Due:
                <asp:Label ID="Fast_Forward_Past_DueLabel" runat="server"
                    Text='<%# Eval("Fast_Forward_Past_Due") %>' />
                <br />
                <br />
            </ItemTemplate>
        </asp:DataList>
        <br />
        <asp:TextBox ID="TextBox1" runat="server" Font-Size="Small"
            Height="33px" Width="534px" BorderStyle="None" Font-Bold="True">All past due amounts need to be added to the Trade up Amount!</asp:TextBox>
   
        <br />
        <asp:TextBox ID="TextBox2" runat="server" Font-Size="Small" Width="914px"
            BorderStyle="None" Font-Bold="True">These figures are estimates and any written order will need to be accompanied by an official trade up quote from MailFinance.</asp:TextBox>
   
        <br />
        <br />
   
        <br />
   
    </div>
       
        <asp:SqlDataSource ID="Boutlist" runat="server"
            ConnectionString="<%$ ConnectionStrings:NewEnglandBO %>">
            <SelectParameters>
                <asp:QueryStringParameter Name="Lease" QueryStringField="Leasenum"
                    Type="String" />
                    <asp:QueryStringParameter Name="table" QueryStringField="Tablename"
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    &nbsp;<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"
        class="style3"></form>
</body>
</html>




Partial Public Class BuyoutPage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Boutlist.SelectCommand = "SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name, [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices, [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due FROM " & Request.QueryString("TableName") & " WHERE ([Lease] = @Lease)"
    End Sub

End Class

Open in new window

0
acardulloSystems Administrator. DBAAuthor Commented:
errors
Error      1      The server tag is not well formed.      C:\Users\acardullo.MODULAR.LOCAL\Documents\Websites\mmsweb\NewEngland.aspx      90      

Error      2      Literal expressions like '<%$ ConnectionStrings:NewEnglandBO %>' are not allowed. Use <asp:Literal runat="server" Text="<%$ ConnectionStrings:NewEnglandBO%>" /> instead.      C:\Users\acardullo.MODULAR.LOCAL\Documents\Websites\mmsweb\NewEngland.aspx      91      

Error      3      Name 'Boutlist' is not declared.      C:\Users\acardullo.MODULAR.LOCAL\Documents\Websites\mmsweb\NewEngland.aspx.vb      6      9      C:\...\mmsweb\

0
hawks4everCommented:
When I use that code, I can build and run the application without any errors.  What version of .NET are you using?
0
acardulloSystems Administrator. DBAAuthor Commented:
3.5
0
acardulloSystems Administrator. DBAAuthor Commented:
my bad.  pasted wrong.  let me test
0
hawks4everCommented:
Try this.  I ignored the Lease parameter.


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NewEngland.aspx.vb" Inherits="BuyoutPage" %>

<!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 id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        .style2
        {
            height: 551px;
        }
        .style3
        {
            height: 25px;
            width: 76px;
        }
    </style>
   
</head>
<body>


    <form id="form1" runat="server" class="style2">
    <div>
   
        &nbsp;<br />
         
        <br />
       
   
        <asp:DataList ID="DataList1" runat="server" DataSourceID="Boutlist"
            Height="228px" RepeatDirection="Horizontal" style="margin-top: 50px"
            Width="520px">
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left"
                VerticalAlign="Top" />
            <ItemTemplate>
                Status:
                <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' />
                <br />
                Lease:
                <asp:Label ID="LeaseLabel" runat="server" Text='<%# Eval("Lease") %>' />
                <br />
                End_Date:
                <asp:Label ID="End_DateLabel" runat="server"
                    Text='<%# Eval("End_Date") %>' />
                <br />
                Customer_Name:
                <asp:Label ID="Customer_NameLabel" runat="server"
                    Text='<%# Eval("Customer_Name") %>' />
                <br />
                Trade_Up:
                <asp:Label ID="Trade_UpLabel" runat="server"
                    Text='<%# Eval("Trade_Up") %>' />
                <br />
                Past_Due_Invoices:
                <asp:Label ID="Past_Due_InvoicesLabel" runat="server"
                    Text='<%# Eval("Past_Due_Invoices") %>' />
                <br />
                FF_Start:
                <asp:Label ID="FF_StartLabel" runat="server" Text='<%# Eval("FF_Start") %>' />
                <br />
                FF_End:
                <asp:Label ID="FF_EndLabel" runat="server"
                    Text='<%# Eval("FF_End") %>' />
                <br />
                Fast_Forward_Past_Due:
                <asp:Label ID="Fast_Forward_Past_DueLabel" runat="server"
                    Text='<%# Eval("Fast_Forward_Past_Due") %>' />
                <br />
                <br />
            </ItemTemplate>
        </asp:DataList>
        <br />
        <asp:TextBox ID="TextBox1" runat="server" Font-Size="Small"
            Height="33px" Width="534px" BorderStyle="None" Font-Bold="True">All past due amounts need to be added to the Trade up Amount!</asp:TextBox>
   
        <br />
        <asp:TextBox ID="TextBox2" runat="server" Font-Size="Small" Width="914px"
            BorderStyle="None" Font-Bold="True">These figures are estimates and any written order will need to be accompanied by an official trade up quote from MailFinance.</asp:TextBox>
   
        <br />
        <br />
   
        <br />
   
    </div>
       
        <asp:SqlDataSource ID="Boutlist" runat="server"
            ConnectionString="<%$ ConnectionStrings:NewEnglandBO %>" />
    &nbsp;<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"
        class="style3"></form>
</body>
</html>


---------------------

Partial Public Class BuyoutPage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Boutlist.SelectCommand = "SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name, [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices, [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due FROM " & Request.QueryString("TableName") & " WHERE ([Lease] = " & Request.QueryString("Leasenum") & ")"
    End Sub

End Class

Open in new window

0
acardulloSystems Administrator. DBAAuthor Commented:
that returns this error when i f5 it
Server Error in '/mmsweb' Application.
--------------------------------------------------------------------------------

Incorrect syntax near the keyword 'WHERE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

0
hawks4everCommented:
Are you passing values for Leasenum and TableName in the querystring?
0
acardulloSystems Administrator. DBAAuthor Commented:
Yes i am. and i verified them to be valid.  the Table value i am passing is test and a valid leasenu,  value as well.
0
acardulloSystems Administrator. DBAAuthor Commented:
sorry  this is the error i get when i actually pass the values
Server Error in '/' Application.
--------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
 
0
hawks4everCommented:
Please modify your web.config file to show the error or run in debug mode and paste where the error is occurring.
0
acardulloSystems Administrator. DBAAuthor Commented:
this is the error i'm getting

this is the url im using

http://mywebsite/NewEngland.aspx?Leasenum=H041007072E?TableName=Test

Server Error in '/' Application.
--------------------------------------------------------------------------------

Incorrect syntax near the keyword 'WHERE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[SqlException (0x80131904): Incorrect syntax near the keyword 'WHERE'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +83
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297
   System.Web.UI.WebControls.BaseDataList.GetData() +38
   System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +153
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +54
   System.Web.UI.WebControls.BaseDataList.DataBind() +55
   System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +60
   System.Web.UI.WebControls.BaseDataList.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
0
acardulloSystems Administrator. DBAAuthor Commented:
did you mean to cut this down to this?

<asp:SqlDataSource ID="Boutlist" runat="server"
            ConnectionString="<%$ ConnectionStrings:NewEnglandBO %>" />
    &nbsp;<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"
        class="style3"></form>

its not longer assigning the variables  to the querystring this way
0
hawks4everCommented:
Try this in your code file
Boutlist.SelectCommand = "SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name, [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices, [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due FROM " & Request.QueryString("TableName") & " WHERE [Lease] = " & Request.QueryString("Leasenum")

Open in new window

0
acardulloSystems Administrator. DBAAuthor Commented:
same error
0
hawks4everCommented:
Can you re-paste your code so I can make sure we're on the same page?  I'm not getting any errors.
0
acardulloSystems Administrator. DBAAuthor Commented:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NewEngland.aspx.vb" Inherits="BuyoutPage" %>

<!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 id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        .style2
        {
            height: 551px;
        }
        .style3
        {
            height: 25px;
            width: 76px;
        }
    </style>
   
</head>
<body>


    <form id="form1" runat="server" class="style2">
    <div>
   
        &nbsp;<br />
         
        <br />
       
   
        <asp:DataList ID="DataList1" runat="server" DataSourceID="Boutlist"
            Height="228px" RepeatDirection="Horizontal" style="margin-top: 50px"
            Width="520px">
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left"
                VerticalAlign="Top" />
            <ItemTemplate>
                Status:
                <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' />
                <br />
                Lease:
                <asp:Label ID="LeaseLabel" runat="server" Text='<%# Eval("Lease") %>' />
                <br />
                End_Date:
                <asp:Label ID="End_DateLabel" runat="server"
                    Text='<%# Eval("End_Date") %>' />
                <br />
                Customer_Name:
                <asp:Label ID="Customer_NameLabel" runat="server"
                    Text='<%# Eval("Customer_Name") %>' />
                <br />
                Trade_Up:
                <asp:Label ID="Trade_UpLabel" runat="server"
                    Text='<%# Eval("Trade_Up") %>' />
                <br />
                Past_Due_Invoices:
                <asp:Label ID="Past_Due_InvoicesLabel" runat="server"
                    Text='<%# Eval("Past_Due_Invoices") %>' />
                <br />
                FF_Start:
                <asp:Label ID="FF_StartLabel" runat="server" Text='<%# Eval("FF_Start") %>' />
                <br />
                FF_End:
                <asp:Label ID="FF_EndLabel" runat="server"
                    Text='<%# Eval("FF_End") %>' />
                <br />
                Fast_Forward_Past_Due:
                <asp:Label ID="Fast_Forward_Past_DueLabel" runat="server"
                    Text='<%# Eval("Fast_Forward_Past_Due") %>' />
                <br />
                <br />
            </ItemTemplate>
        </asp:DataList>
        <br />
        <asp:TextBox ID="TextBox1" runat="server" Font-Size="Small"
            Height="33px" Width="534px" BorderStyle="None" Font-Bold="True">All past due amounts need to be added to the Trade up Amount!</asp:TextBox>
   
        <br />
        <asp:TextBox ID="TextBox2" runat="server" Font-Size="Small" Width="914px"
            BorderStyle="None" Font-Bold="True">These figures are estimates and any written order will need to be accompanied by an official trade up quote from MailFinance.</asp:TextBox>
   
        <br />
        <br />
   
        <br />
   
    </div>
       
        <asp:SqlDataSource ID="Boutlist" runat="server"
            ConnectionString="<%$ ConnectionStrings:NewEnglandBO %>" />
    &nbsp;<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"
        class="style3"></form>
</body>
</html>

My back code




Partial Public Class BuyoutPage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Boutlist.SelectCommand = "SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name, [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices, [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due FROM " & Request.QueryString("TableName") & " WHERE [Lease] = " & Request.QueryString("Leasenum")
    End Sub

End Class

Open in new window

0
hawks4everCommented:
What data type is Lease?  You may have to modify to include apostrophes.  Perhaps I incorrectly assumed it was an integer.
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Boutlist.SelectCommand = "SELECT [Status],[Lease], [End Date] AS End_Date, [Customer Name] AS Customer_Name, [Trade Up] AS Trade_Up, [Past Due Invoices] AS Past_Due_Invoices, [FF Start] AS FF_Start, [FF End] AS FF_End, [Fast Forward Past Due] AS Fast_Forward_Past_Due FROM " & Request.QueryString("TableName") & " WHERE [Lease] = '" & Request.QueryString("Leasenum") & "'"
    End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
acardulloSystems Administrator. DBAAuthor Commented:
they are both strings
0
hawks4everCommented:
What data type is the Lease column in your table?
0
acardulloSystems Administrator. DBAAuthor Commented:
nvarchar

the problem was wiht the url string.   it needed to be http://myweb?attrib1=Value1&attrib2=value2

it needed the ampersand and not a second ?
0
hawks4everCommented:
That would do it.
0
acardulloSystems Administrator. DBAAuthor Commented:
ok  thanks for all the help.  got ti working now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.