RE: Stored procedure / .NET woes
- From: "Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 13 Apr 2005 06:01:03 -0700
Check the available network protocols on both the server and the client (web
server), using the SQL client and server network tools.
Most likely, the web server is set up with TCP and you do not have this
protocol installed on the server. If this is the case, installing will likely
cure. If it does not, move the TCP protocol up higher on the list and you
should be fine.
NOTE: Query Analyzer is more flexible on protocol than a web app, so it is
not surprising you can still connnect with it.
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"mfos239" wrote:
>
> I have no idea what is going on here, maybe someone can help me out.
>
> I have developed an application for my company's intranet using ASP.net
> and SQL Server. We have two servers, one hosts the .NET apps and the
> other runs SQL Server 2000. The application runs without a hitch most
> of the time, but every morning I experience the same exact problem. One
> (and only one) page which gets its data using a stored procedure call to
> SQL Server throws an exception "General Network Error. Check your
> Network Documentation." It will throw this exception or just return 0
> results.
>
> I did a test to see if there was something else on the page causing
> problems. I created a separate test page with only a call to the stored
> procedure. The procedure still yields the same "General Network Error."
>
> Strangely enough running the same stored procedure through the SQL
> Query Analyzer does not produce an error and instead runs perfectly
> fine and returns the expected results.
>
> A temporary solution I have found is to simplify the stored procedure
> in SQL Server by removing its WHERE clause, apply the changes, then go
> back to my .net app and run the page. The page loads fine. I then go
> back to the procedure again and reinsert the WHERE clause to change it
> back to what it was originally. I apply the changes and my .net app
> still works fine.
>
> It will continue to work fine the rest of the day and then in the
> morning the same problem will crop up again. The only thing we can
> think of at all is that there is a backup performed each night. But why
> would this affect a stored procedure? And even if it did, seems like
> that same stored procedure would have a problem in SQL Query Analyzer
> as well as .NET.
>
> Any ideas?
>
> Here are some code snippets:
>
>
> Code:
> --------------------
> CREATE PROCEDURE usp_GetActiveClients (
> @FirstLetter varchar(5) = '')
> AS
> SELECT c.CompanyID, c.ParentCoID, dbo.MoveTheToEnd(c.CompanyName) as CompanyName,
> dbo.GetCompanyStatusForProgram(c.CompanyID, ParentCoID, 1) as State,
> dbo.GetCompanyStatusForProgram(c.CompanyID, ParentCoID, 2) as Federal,
> dbo.GetCompanyStatusForProgram(c.CompanyID, ParentCoID, 3) as WOTC,
> dbo.GetCompanyStatusForProgram(c.CompanyID, ParentCoID, 4) as BusIncentives,
> dbo.GetCompanyStatusForProgram(c.CompanyID, ParentCoID, 5) as Sales
> FROM tblCompanyHeader c
> WHERE c.CompanyID=ParentCoID AND dbo.IsActiveClient(CompanyID) = 1
> AND (CompanyName LIKE @FirstLetter+'%'
> OR CompanyName LIKE 'The ' + @FirstLetter+'%')
> ORDER BY CompanyName
> GO
> --------------------
>
>
>
> Code:
> --------------------
> CREATE FUNCTION GetCompanyStatusForProgram (
> @CompanyID int,
> @ParentCoID int,
> @CompanyProgramID int)
> RETURNS varchar(20)
> AS
> BEGIN
>
> DECLARE @StatusType varchar(20)
>
> SELECT @StatusType=st.StatusType
> FROM tblCompanyStatus cs INNER JOIN tblListStatusType st ON cs.StatusTypeID=st.StatusTypeID
> WHERE cs.CompanyID=@CompanyID
> AND cs.CompanyProgramID=@CompanyProgramID
>
> IF @@rowcount > 0
> RETURN @StatusType
> ELSE
> SELECT @StatusType=st.StatusType
> FROM tblCompanyStatus cs INNER JOIN tblListStatusType st ON cs.StatusTypeID=st.StatusTypeID
> WHERE cs.CompanyID=@ParentCoID
> AND cs.CompanyProgramID=@CompanyProgramID
>
> RETURN @StatusType
> END
> --------------------
>
>
>
> Code:
> --------------------
> CREATE FUNCTION IsActiveClient
> ( @CompanyID int)
> RETURNS bit
> AS
> BEGIN
> DECLARE @cnt int
> SELECT @cnt = count(*)
> FROM tblCompanyStatus cs
> WHERE cs.CompanyID=@CompanyID
> AND (cs.StatusTypeID = 1 OR cs.StatusTypeID = 6)
> AND (cs.CompanyProgramID = 1
> OR cs.CompanyProgramID = 2
> OR cs.CompanyProgramID = 3
> OR cs.CompanyProgramID = 4)
> RETURN @cnt
> END
> --------------------
>
>
> --
> mfos239
> ------------------------------------------------------------------------
> mfos239's Profile: http://www.msusenet.com/member.php?userid=483
> View this thread: http://www.msusenet.com/t-1869412874
>
>
.
- References:
- Stored procedure / .NET woes
- From: mfos239
- Stored procedure / .NET woes
- Prev by Date: RE: ntext displayed in a data grid
- Next by Date: Re: Multiple DataTables in Dataset
- Previous by thread: Re: Stored procedure / .NET woes
- Next by thread: DataSet Transactions Help
- Index(es):
Relevant Pages
|