HWY909
03-01-2011, 05:22 PM
Hello, I recently upgraded my /net program to 2010 and SQL 2008 and my datareaders stopped working. Everything else works as it always did. Is my syntax out of date? The stored procedure works fine in Management Studio. Here's one of them: SqlCommand cmdBudgetList = new SqlCommand("stpBudget", cs); cmdBudgetList.CommandType = CommandType.StoredProcedure; SqlParameter bScenRunID = new SqlParameter("@ScenarioRunID", SqlDbType.Int); bScenRunID.Value = Session["ScenarioRunID"]; cmdBudgetList.Parameters.Add(bScenRunID); SqlParameter bYear = new SqlParameter("@Year", SqlDbType.Int); bYear.Value = Year; cmdBudgetList.Parameters.Add(bYear); SqlParameter bSYear = new SqlParameter("@StartYear", SqlDbType.Int); bSYear.Value = StartYear; cmdBudgetList.Parameters.Add(bSYear); SqlDataReader rBudget = cmdBudgetList.ExecuteReader();
The stp is USE [datafile] GO /****** Object: StoredProcedure [dbo].[stpBudget] Script Date: 02/27/2011 19:40:21 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[stpBudget] @ScenarioRunID as int, @Year as int, @StartYear as int AS SET NOCOUNT ON; SELECT * FROM ScenarioBudget WHERE ScenarioBudget.ScenarioRunID= @ScenarioRunID AND ScenarioBudget.[Year]= @Year - @StartYear + 1; and the database is at (pasted from web.config) Connection string is SqlConnection cs = new SqlConnection(ConfigurationManager.ConnectionStrings["SGRConnectionString"].ConnectionString)
Optional Information:
Computer OS: Windows 7
Browser: Firefox
Already Tried:
Everything I could think of except downgrading all my software, which would destroy my other projects. BTW, the DataReaders just give empty sets when run in VS.Net (although not in SQL Studio).
The stp is USE [datafile] GO /****** Object: StoredProcedure [dbo].[stpBudget] Script Date: 02/27/2011 19:40:21 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[stpBudget] @ScenarioRunID as int, @Year as int, @StartYear as int AS SET NOCOUNT ON; SELECT * FROM ScenarioBudget WHERE ScenarioBudget.ScenarioRunID= @ScenarioRunID AND ScenarioBudget.[Year]= @Year - @StartYear + 1; and the database is at (pasted from web.config) Connection string is SqlConnection cs = new SqlConnection(ConfigurationManager.ConnectionStrings["SGRConnectionString"].ConnectionString)
Optional Information:
Computer OS: Windows 7
Browser: Firefox
Already Tried:
Everything I could think of except downgrading all my software, which would destroy my other projects. BTW, the DataReaders just give empty sets when run in VS.Net (although not in SQL Studio).