((Site_City = ISNULL(@City, Site_City)) OR @City is Null OR (Site_City LIKE '&' + @City + '%'))
AND ((Site_Zip = ISNULL(@Zip, Site_Zip)) OR @Zip is Null OR (Site_Zip LIKE '&' + @Zip + '%'))
) Records)
RETURN @Temp
When I EXECUTE this procedure in either SQL Server or in the Database Explorer in Microsoft Web Developer 2010, with the parameters @City = “Jacksonville” and @Zip = “32202”, the return value is 2048
When I EXECUTE this procedure in as a vb script (using the below code) in a webpage in Microsoft Web Developer 2010, with the parameters @City = “Jacksonville” and @Zip = “32202”, the return value is 0
Vb script in webpage
<script language="VB" runat="server">
...
Sub UpdateRecords(sender As Object, e As EventArgs)
Dim scalarQueriesTableAdapter As Parcels_and_OwnersTableAdapters.Parcels_and_OwnersTableAdapter
scalarQueriesTableAdapter = New Parcels_and_OwnersTableAdapters.Parcels_and_OwnersTableAdapter
Dim returnValue As Integer
If RadioList1.SelectedIndex = 0 Then 'Zipcode filter selected
Someone offline helped to resolve the issue. The problem was in trying to pass values through the returnvalue. I changed to an output parameter and everything works fine.
None
0 Points
2 Posts
Problem with TableAdapters
Mar 11, 2013 07:57 PM|mjones|LINK
I am really struggling with the following code in an application
I have a SQL Server Stored Procedure
CREATE PROCEDURE [dbo].GetRecordCount ( @City varchar(255) = null, @Zip varchar(50) = null )
AS
SET NOCOUNT ON;
DECLARE @TEMP as Integer
SET @TEMP =
(SELECT
SUM(RecordCount) RecordCount
FROM
(
SELECT
Site_City, Site_Zip, COUNT(1) AS RecordCount
FROM
Parcels_and_Owners
GROUP BY
Site_City, Site_Zip
HAVING
((Site_City = ISNULL(@City, Site_City)) OR @City is Null OR (Site_City LIKE '&' + @City + '%'))
AND ((Site_Zip = ISNULL(@Zip, Site_Zip)) OR @Zip is Null OR (Site_Zip LIKE '&' + @Zip + '%'))
) Records)
RETURN @Temp
When I EXECUTE this procedure in either SQL Server or in the Database Explorer in Microsoft Web Developer 2010, with the parameters @City = “Jacksonville” and @Zip = “32202”, the return value is 2048
When I EXECUTE this procedure in as a vb script (using the below code) in a webpage in Microsoft Web Developer 2010, with the parameters @City = “Jacksonville” and @Zip = “32202”, the return value is 0
Vb script in webpage
<script language="VB" runat="server">
...
Sub UpdateRecords(sender As Object, e As EventArgs)
Dim scalarQueriesTableAdapter As Parcels_and_OwnersTableAdapters.Parcels_and_OwnersTableAdapter
scalarQueriesTableAdapter = New Parcels_and_OwnersTableAdapters.Parcels_and_OwnersTableAdapter
Dim returnValue As Integer
If RadioList1.SelectedIndex = 0 Then 'Zipcode filter selected
returnValue = CType(scalarQueriesTableAdapter.GetRecordCount("Jacksonville", "32202"), Integer)
End If
If RadioList1.SelectedIndex = 1 Then 'City filter selected
returnValue = CType(scalarQueriesTableAdapter.GetRecordCount(DropDownList2.Text, Nothing), Integer)
End If
TextBox1.Text = returnValue
End Sub
. . .
</script>
I have been unable to resolve the problem. Hopefuly someone here can see where I an going wrong.
None
0 Points
2 Posts
Re: Problem with TableAdapters
Mar 11, 2013 11:10 PM|mjones|LINK
Someone offline helped to resolve the issue. The problem was in trying to pass values through the returnvalue. I changed to an output parameter and everything works fine.