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