Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Repeater Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ297 - 10 Mar 2008 16:12 GMT
Plamen Ratchev helped me set up my stored procedure which is working
well, thanks again Plamen!

Create procedure GetByDate

@FromDate datetime,
@ToDate datetime

AS
select * from spslist

where pmtdate between @fromdate and @todate

My problem:

I have two text boxes FromDate and ToDate on the screen.  After the
user enter's the two dates the above stored procedure executes but no
data appears on the screen.

On button click I have this:

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
       Dim conn As New
Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("SPSConnectionString").ConnectionString)

       Dim cmd As New Data.SqlClient.SqlCommand
       Dim cmdTopics As New Data.SqlClient.SqlCommand

       With cmdTopics
           .CommandType = Data.CommandType.StoredProcedure

           .CommandText = "GetByDate"
           .Connection = conn

           .Parameters.AddWithValue("@FromDate", FromDte.Text)
           .Parameters.AddWithValue("@ToDate", ToDte.Text)

           Response.Redirect("default.aspx")

       End With
   End Sub
End class

I want my results to go to the default.aspx page.  Are my select
parameters correct?

Here's the default.aspx page:

 <center><asp:Repeater ID="Repeater1" runat="server"
DataSourceID="SqlDataSource1">

       <HeaderTemplate>
      <table>
      <tr>
      <Th><font color="#330099">Name and Address: </font>
      </Th>
      <td colspan="12"><th><font color="#330099">Payment, Processing,
and Jurisdiction Information</font>
      </th></td>

      </tr>
          </HeaderTemplate>
       <ItemTemplate>
       <tr>
       <td><font color="#330099">Claim SSN: </font><b><%#
Eval("ClaimSSN") %></b></td>
        <td colspan="2"></td>
        <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
b></td>

        <td colspan="2"></td>

        <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
Eval("BICSSN") %></b></td>

        <tr></tr>
        <td colspan="7"></td>

        <td colspan="7"><font color="#330099">PMT Amount: </font><b><
%# Eval("PMTAMT", "{0:c2}")%></b></td>

       <td><font color="#330099">PMT Code: </font><b><%#
Eval("PMTCODE") %></b></td>

       <tr></tr>
       <td colspan="7"></td>

       <td colspan="7"><font color="#330099">PMT Date: </font><b><%#
Eval("PMTDate", "{0:d}")%></b></td>
        <tr></tr>
       <td colspan="7"></td>
       <td colspan="7"><font color="#330099">Status Code: </font><b><
%# Eval("StatusCode")%></b></td>

       <td><font color="#330099">Pin: </font><b><%#Eval("PIN")%></b></
tr>
       </ItemTemplate>
     <SeparatorTemplate>
       <tr>
       <td colspan="100%"><hr size="1" color=#330099 /><br />

       </td>

       </tr>

       </SeparatorTemplate>
       <FooterTemplate>
       </table>
       </FooterTemplate>
       </asp:Repeater></center>

   </div>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:SPSConnectionString %>"
           SelectCommand="GETByDate"
SelectCommandType="StoredProcedure">
           <SelectParameters>
               <asp:FormParameter FormField="FromDate"
Name="FromDate" Type="DateTime" />
               <asp:FormParameter FormField="ToDate" Name="ToDate"
Type="DateTime" />
           </SelectParameters>
       </asp:SqlDataSource>
bruce barker - 10 Mar 2008 16:23 GMT
you never do anything with the textbox values. in the onclick you do a
redirect, which ends the current request. you proably want to save the text
values in session, then modify defaust.aspx to use sessions values.

-- bruce (sqlwork.com)

> Plamen Ratchev helped me set up my stored procedure which is working
> well, thanks again Plamen!
[quoted text clipped - 120 lines]
>             </SelectParameters>
>         </asp:SqlDataSource>
JJ297 - 10 Mar 2008 17:11 GMT
On Mar 10, 11:23 am, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> you never do anything with the textbox values. in the onclick you do a
> redirect, which ends the current request. you proably want to save the text
[quoted text clipped - 128 lines]
>
> - Show quoted text -

Thanks Bruce I have it working now.  Added this:

Session("Fromdate") = FromDte.Text
       Session("toDate") = ToDte.Text

and added this on the default page:
<SelectParameters>
               <asp:SessionParameter Name="FromDate"
SessionField="FromDate" Type="DateTime" />
               <asp:SessionParameter Name="ToDate"
SessionField="ToDate" Type="DateTime" />
           </SelectParameters>

Love these forums as I'm learning so much from you experts!

Thanks again!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.