Repeater Question

J

JJ297

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>
 
B

bruce barker

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)
 
J

JJ297

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)




































- 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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top