Showing posts with label current. Show all posts
Showing posts with label current. Show all posts

Sunday, March 25, 2012

A way to reference the value in the current cell, not by name?

Is there any way to reference the value in the current table cell (Textbox)
from within formulas in that cell? I am curious because there are many places,
like 'Visiblity' where I would like to set it based on the current value,
but need to duplicate the formula I use for "Value". I would rather not
reference the name of the cell (like textbox4, etc), because that ALSO does
not change if I rename the cell, leaving yet another dangling reference.
I have many forumlas in the 'Visiblity->Expression' field that look like
this :
=Fields!with_xxxx_value.Value < 1
When I would like to have this (or something to that effect)
= CurrentObj.Value < 1, where CurrentObj would = the textbox, and Value
would = the "Value" expression for it.
Thanks,
// Andrew
P.S. Why does "Visibility->Expression:" seem to have the opposite effect?
If I want to HIDE a field when the value is < 0, then I have to set the
formula to "= Fields!the_value.Value < 1", which of course evaluates to TRUE
when I want to set Visible to False. Verrrrry funny.Hey Andrew,
I haven't actually tried this, but you the "ME" keyword might be what
your looking for i.e. Me.value
Michael
"Andrew Backer" wrote:
> Is there any way to reference the value in the current table cell (Textbox)
> from within formulas in that cell? I am curious because there are many places,
> like 'Visiblity' where I would like to set it based on the current value,
> but need to duplicate the formula I use for "Value". I would rather not
> reference the name of the cell (like textbox4, etc), because that ALSO does
> not change if I rename the cell, leaving yet another dangling reference.
> I have many forumlas in the 'Visiblity->Expression' field that look like
> this :
> =Fields!with_xxxx_value.Value < 1
> When I would like to have this (or something to that effect)
> = CurrentObj.Value < 1, where CurrentObj would = the textbox, and Value
> would = the "Value" expression for it.
> Thanks,
> // Andrew
> P.S. Why does "Visibility->Expression:" seem to have the opposite effect?
> If I want to HIDE a field when the value is < 0, then I have to set the
> formula to "= Fields!the_value.Value < 1", which of course evaluates to TRUE
> when I want to set Visible to False. Verrrrry funny.
>
>

Thursday, March 8, 2012

A simple query that returns the most current address

Hi,

I have an Address table which contains more than one addresses for a
particular member. I want to write a query that would only display
most current address. All addresses have a unique ID (addID).
Example:

memberID addID address1
--- -- ----------------
295 69 13 Auster St
295 70 465 Lorre Ct
295 71 P.O. Box 321
722 171 10 Hannaford Rd
722 172 Dubai, United Arab Emirates

Quote:

Originally Posted by

>From the table data above. The query should only return


memberID addID address1
--- -- ----------------
295 71 P.O. Box 321
722 172 Dubai, United Arab Emirates

I tried using Max and Group by function but it shows me all the rows.
If you can provide me with a sample code that would greatly
appreciated.

cheersRex wrote:

Quote:

Originally Posted by

I have an Address table which contains more than one addresses for a
particular member. I want to write a query that would only display
most current address. All addresses have a unique ID (addID).
Example:
>
memberID addID address1
--- -- ----------------
295 69 13 Auster St
295 70 465 Lorre Ct
295 71 P.O. Box 321
722 171 10 Hannaford Rd
722 172 Dubai, United Arab Emirates
>

Quote:

Originally Posted by

>>From the table data above. The query should only return


>
memberID addID address1
--- -- ----------------
295 71 P.O. Box 321
722 172 Dubai, United Arab Emirates
>
I tried using Max and Group by function but it shows me all the rows.
If you can provide me with a sample code that would greatly
appreciated.


Assuming that each member's most current address has the largest
addID value, and that addID values are not re-used from one member
to the next:

select memberID, addID, address1
from the_table
where addID in (
select max(addID)
from the_table
group by memberID
)

A severe error occurred on the current command. The results, if any, should be discarded.

Hi,

I am hosting my ASP.NET application on a Host and after some time I get this error
(Don't get it on my development machine):

A severe error occurred on the current command. The results, if any, should be discarded.

And then it says this on the same page:

Exception Details: System.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

[SqlException: A severe error occurred on the current command. The results, if any, should be discarded.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +643
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +9
ASPNetPortal.PortalSettings..ctor(Int32 tabIndex, Int32 tabId)
ASPNetPortal.Global.Application_BeginRequest(Object sender, EventArgs e)
System.Web.SyncEventExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I thought this is a problem with max pool size and I did it max pool size = 5000, now application runs ok for some time and then produces this error but some times this comes very soon.

As a solution, I have to copy my dll in bin directory again and application restarts and works properly but then after some time this happenes again.

Please let me know whats the problem.
I checked all of my SqlDataReaders and SqlConnections are closed properly.

Any help would be appreciated.

Thanks.

Rahul.Rahul,

Getting a similar problem. I've narrowed it down to 3 stored procedures I wrote, others work fine. In the win2k server event view you should see a message

Error: 17805, Severity: 18, State: 3
2002-09-05 10:39:41.68 ods Invalid buffer received from client.

I've noticed that the StroProc often hangs when using the 'run stored procedure' function in the Explorer window in the V NET IDE. However the data still gets added. This would suggest the StorProc isn't returning a result to the code in time.

Like you our test server is fine. This runs SQL Server 2000 Developer Edition (SP1)

The production server runs SQL Server 7.0 (SP4)

Do your StroProcs use char or varchar types with a 50+ size or have a large number of parameters?

Regards

Richard|||Hi Richard,

Thanks a lot for your support.
Well! Certainly I am using varchar for 50+ size.

But I think I figured out the problem (still not sure) because since last two days I didn't get this error message, for this success I made some changes to my code.

If you think to discuss these changes would be worth then please let me know.

Thanks a lot again.

Rahul.|||So, did anyone ever figure the answer to this problem? I'm having the same issue, development server works fine (SQL2K), production server craps out (SQL7) with errors "Invalid Buffer received from client"|||If anyone's tracking this thread, here's an update: I moved the database to another production server running SQL2000, and it runs flawlessly. So the root cause is something in the way SQL7 handles SP's from .Net. More updates to come as I find them...|||We are having the same problem (with tables in our .NET Forums database) and found this info on a microsoft newsgroup)
Unfortunately the stricter datatype processing is a side effect of the 031
patch. We're working on a KB article to explain the behavior and scope.
Here is a draft of our work in progress:

KB 827366 – “Error 17805: Invalid Buffer Received from Client? Error
Message in SQL”

-----------------------
--

The information in this article applies to:

- Microsoft .NET Framework 1.0 (Version: 1.0)

- Microsoft .NET Framework 1.1

-----------------------
--

SYMPTOMS

========

When you use the SqlClient .NET Framework classes, the following error
messages may appear in the SQL Server 2000 error log:

Error: 17805, Severity: 20, State: 3

Invalid buffer received from client.

The following corresponding errors may appear in the client .NET
application:

System.Data.SqlClient.SqlException: A severe error occurred on
the current command. The results, if any, should be discarded

-or-

System.Data.SqlClient.SqlException: Procedure or function
spXXXX has too many arguments specified.

Note If you are using the .NET Framework 1.1 you only see the last error
message.

CAUSE

=====

There are three causes for these errors:

- You use SqlClient classes in a Finalize method or C# destructor. Do not
use any managed classes in a Finalize method or C# destructor.

- You do not specify an explicit SQLDbType for the parameters. In this
case, the SqlClient .NET provider tries to select the correct SQLDbType
based on the data that is passed and it will fail.

- If the size of the parameter that is specified explicitly in the .NET
code is more than the maximum allowable size for the data type in the SQL
Server.

- For example: According to SQL Server Books Online, nvarchar is a
Variable-length Unicode character data of n characters. n must be a value
from 1 through 4,000 If you specify a size that is more than 4000 for an
nvarchar parameter, then you will receive the error message that the
"Symptoms" section describes.

The following code also demonstrates how these errors can occur:

Stored Procedure

--------

PROCEDURE spParameterBug @.myText Text AS

Insert Into ParameterBugTable (TextField) Values
(@.myText)

Code

---

static void Main(string[] args)

{

string dummyText=string.Empty;

for (int n=0; n < /*80*/ 3277; n++) // change this to
80 to get the second error above

{

dummyText += "0123456789";

}

// TO DO: Change data source to match your SQL Server:

SqlConnection con= new SqlConnection("data
source=myserver;Initial Catalog=mydb;Integrated Security=SSPI;persist
security info=True;packet size=16384");

SqlCommand cmd = new SqlCommand("SpParameterBug", con);

// Correct invocation:

SqlParameter param =new SqlParameter("@.myText",
SqlDbType.Text);

param.Value = dummyText;

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add(param);

con.Open();

try

{

cmd.ExecuteNonQuery();

}

catch (Exception err)

{

Console.WriteLine(err.ToString());

}

// Causes error 17805:

SqlParameter param2 =new SqlParameter("@.myText",
dummyText);

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add(param2);

try

{

cmd.ExecuteNonQuery();

}

catch (Exception err)

{

Console.WriteLine(err.ToString());

}

Console.ReadLine();

}

RESOLUTION

==========

To resolve these errors, make sure that you do the following:

1. Do not use SqlClient classes in a Finalize method or a C# destructor.

2. Specify the SqlDbType for the SqlParameter so that there is no inferred
type.

3. Specify a parameter size that is within the allowable limits of the data
type.

REFERENCES

==========

For more information about the maximum size for different data types, see
these sections of SQL Books Online:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_
na-nop_9msy.asp: nchar and nvarchar

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_
da-db_7msw.asp: Data Types

Shawn Aebi
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.|||Actually here is a link to the thread...
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=IsYbP1AdDHA.2408%40cpmsftngxa06.phx.gbl&rnum=1&prev=/groups%3Fq%3Dsql%2Bserver%2B17805%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26scoring%3Dd%26selm%3DIsYbP1AdDHA.2408%2540cpmsftngxa06.phx.gbl%26rnum%3D1|||i faced the same error, but found that i was executing "return" in the middle of the transaction and thus the bug was fixed by completing the transaction.

A severe error occurred on the current command.

I am having problems with an error that I keep receiving. The error message states "A severe error occurred on the current command. The results, if any, should be discarded."

This error is popping up when I try to call a specific stored procedure in SQL2005. The error is not specific to ASP.NET code because it also occurs if I try to run the procedure in SQL Server Management Studio. The procedure is exactly the same that is running on an SQL2000 server on a live site, so it apparently is specific to SQL2005.

I have not worked much with SQL2005 or SQL cursors in the past and this code was not written by me so I am not sure where to start making changes, if any are needed.

The procedure is as follows:

ALTER PROCEDURE [dbo].[spGetAdmins]
@.userid int,
@.forDate datetime
AS

DECLARE @.lngTabCount INTEGER,
@.lngLoopCount INTEGER,
@.type varchar(15),
@.id varchar(20),
@.statement varchar(1000),
@.useridLocal int,
@.forDateLocal datetime

SET @.useridLocal = @.userid
SET @.forDateLocal = @.forDate

DECLARE @.AdminInfo TABLE (AdminID varchar(20), AdminName varchar(50))

/* check parameters */
IF (@.useridLocal <= 0)
BEGIN
RAISERROR( 'Invalid UserID (%d)', 16, 1, @.useridLocal )
END
IF (@.forDateLocal IS NULL)
BEGIN
SELECT @.forDateLocal = GETDATE()
END

DECLARE profInfo CURSOR
LOCAL FORWARD_ONLY
FOR
SELECT ProfileType, ProfileValue
FROM tblCSUserProfile
WHERE UserID = @.useridLocal and
(StartDate is not null or StartDate <= @.forDateLocal ) and
(EndDate is null or EndDate > @.forDateLocal )
ORDER BY ProfileType

OPEN profInfo
FETCH profInfo
INTO @.type, @.id

WHILE @.@.Fetch_Status = 0
BEGIN
IF @.id = '*'
BEGIN
INSERT INTO @.AdminInfo
VALUES ('*', '* Everything')
END
ELSE
BEGIN
INSERT INTO @.AdminInfo
SELECT adm.[ADM_CODE], adm.[ADMIN_NAM]
FROM OPENROWSET('SQLOLEDB', 'server'; 'database'; 'password', [table]) AS adm
WHERE adm.[ADM_CODE] = @.id
END

FETCH profInfo INTO @.type, @.id

END

CLOSE profInfo

DEALLOCATE profInfo

SELECT DISTINCT(UPPER(AdminID)) AS AdminCode
FROM @.AdminInfo
GROUP BY AdminID
ORDER BY AdminCode

(1) I would change the line

FETCH profInfo
INTO @.type, @.id

to

FETCH NEXT FROM profInfo INTO @.type, @.id

and


FETCH profInfo INTO @.type, @.id

to

FETCH NEXT FROM profInfo INTO @.type, @.id

I would also recommend using a table variable instead of cursors.

(2) Check out the syntax for OPENROWSET in BOL.

Try using the SQLNCLI (SQL Native Client) instead of SQLOLEDB and see if it makes a difference.

 

A severe error occurred on the current command.

When ever I run a particular report. Even if I set the
connection to don't time out. I keep getting this:
An error has occurred during report processing.
(rsProcessingAborted) Get Online Help Cannot read the next
data row for the data set MOPhoneSkins.
(rsErrorReadingNextDataRow) Get Online Help
A severe error occurred on the current command. The
results, if any, should be discarded.
I don't understand what's going on. Please help me out if
you've had this problem.
Thanks in advance,
BryanThis exception comes from the ADO.NET / the underlying data provider.
Reporting Services just wraps the exception.
There are many possible reasons why this exception can happen. One example:
you specify a stored procedure on server A in your report as data source. At
runtime this stored procedure tries to invoke another stored procedure on
server B through the linked server feature and fails because of missing
privileges to execute stored procedures on server B.
You might want to search ADO related newsgroups (e.g.
news:microsoft.public.dotnet.framework.adonet) or on the internet for the
exception message string "A severe error occurred on the current command.
The results, if any, should be discarded."
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"bmurtha" <anonymous@.discussions.microsoft.com> wrote in message
news:635a01c4826b$677f3d00$a501280a@.phx.gbl...
> When ever I run a particular report. Even if I set the
> connection to don't time out. I keep getting this:
> An error has occurred during report processing.
> (rsProcessingAborted) Get Online Help Cannot read the next
> data row for the data set MOPhoneSkins.
> (rsErrorReadingNextDataRow) Get Online Help
> A severe error occurred on the current command. The
> results, if any, should be discarded.
> I don't understand what's going on. Please help me out if
> you've had this problem.
> Thanks in advance,
> Bryan

A severe error occurred on the current command

Dear fellow sufferers...
I get the error noticed in the subjectline, while trying to put a 150MB
ZipFile into a SQL-2000-SP4-DB. This is the way I do it:
'***************************************
************************************
***********************
Public Function CYCLE__GisData_ZIP_Add(ByRef lCycleID As Long, _
ByVal sZipFile As String, _
ByRef sRetErrMsg As String) As Boolean
' Local Variables
Dim bError As Boolean
Dim sRetErrMsgSub As String
Dim fiZipFile As IO.FileInfo
Dim sSQL As String
Dim lFileLength As Long
Dim fileStream As IO.FileStream
Dim binReader As IO.BinaryReader
Dim binaryData() As Byte
Dim cmdSQL As SqlCommand
Dim paraSQL As SqlParameter
'-> reset return value
CYCLE__GisData_ZIP_Add = False
bError = False
sRetErrMsg = "Function: " & mc_sClassName & ".CYCLE__GisData_ZIP_Add"
Try
fiZipFile = New IO.FileInfo(sZipFile)
'-> save to Stream
fileStream = fiZipFile.OpenRead
binReader = New IO.BinaryReader(fileStream)
binaryData = binReader.ReadBytes(fileStream.Length)
lFileLength = fileStream.Length
binReader.Close()
fileStream.Close()
sSQL = "UPDATE tab_Cycle " + _
"SET GIS_Data = @.GIS_Data " + _
"WHERE (id = " & lCycleID & ")"
cmdSQL = New SqlCommand(sSQL, m_con_eRM_RFC)
paraSQL = New SqlParameter("@.GIS_Data", SqlDbType.Image)
paraSQL.Direction = ParameterDirection.Input
paraSQL.Value = binaryData
cmdSQL.Parameters.Add(paraSQL)
cmdSQL.ExecuteNonQuery()
Catch ex As System.Data.SqlClient.SqlException
Dim strSQLErr As String
Dim sqlErr As SqlError
For Each sqlErr In ex.Errors
strSQLErr = strSQLErr & sqlErr.ToString & vbNewLine
Next sqlErr
Throw New Exception(strSQLErr)
Catch ex As Exception
Throw New Exception(sRetErrMsg & sRetErrMsgSub & vbCrLf &
ex.ToString & vbCrLf)
Finally
'-> set return value
CYCLE__GisData_ZIP_Add = Not bError
End Try
End Function
'***************************************
************************************
***********************
All objects used are filled and the error occures on the
cmdSQL.ExecuteNonQuery(). There is no SQL-Errornumber or something like
that...
Any ideas or hints are welcome!
Cheers,
ChristophFor large binary streams, use a chunking method rather than sending the
entire value at once. See MSKB 317043
<http://support.microsoft.com/defaul...kb;en-us;317043> for an
examples.
Hope this helps.
Dan Guzman
SQL Server MVP
"Cheffe" <Cheffe@.discussions.microsoft.com> wrote in message
news:054F78D7-C8E9-405E-A67B-BB856074E090@.microsoft.com...
> Dear fellow sufferers...
> I get the error noticed in the subjectline, while trying to put a 150MB
> ZipFile into a SQL-2000-SP4-DB. This is the way I do it:
> '***************************************
**********************************
*************************
> Public Function CYCLE__GisData_ZIP_Add(ByRef lCycleID As Long, _
> ByVal sZipFile As String, _
> ByRef sRetErrMsg As String) As Boolean
> ' Local Variables
> Dim bError As Boolean
> Dim sRetErrMsgSub As String
> Dim fiZipFile As IO.FileInfo
> Dim sSQL As String
> Dim lFileLength As Long
> Dim fileStream As IO.FileStream
> Dim binReader As IO.BinaryReader
> Dim binaryData() As Byte
> Dim cmdSQL As SqlCommand
> Dim paraSQL As SqlParameter
>
> '-> reset return value
> CYCLE__GisData_ZIP_Add = False
> bError = False
> sRetErrMsg = "Function: " & mc_sClassName &
> ".CYCLE__GisData_ZIP_Add"
> Try
> fiZipFile = New IO.FileInfo(sZipFile)
> '-> save to Stream
> fileStream = fiZipFile.OpenRead
> binReader = New IO.BinaryReader(fileStream)
> binaryData = binReader.ReadBytes(fileStream.Length)
> lFileLength = fileStream.Length
> binReader.Close()
> fileStream.Close()
> sSQL = "UPDATE tab_Cycle " + _
> "SET GIS_Data = @.GIS_Data " + _
> "WHERE (id = " & lCycleID & ")"
> cmdSQL = New SqlCommand(sSQL, m_con_eRM_RFC)
> paraSQL = New SqlParameter("@.GIS_Data", SqlDbType.Image)
> paraSQL.Direction = ParameterDirection.Input
> paraSQL.Value = binaryData
> cmdSQL.Parameters.Add(paraSQL)
> cmdSQL.ExecuteNonQuery()
>
> Catch ex As System.Data.SqlClient.SqlException
> Dim strSQLErr As String
> Dim sqlErr As SqlError
> For Each sqlErr In ex.Errors
> strSQLErr = strSQLErr & sqlErr.ToString & vbNewLine
> Next sqlErr
> Throw New Exception(strSQLErr)
> Catch ex As Exception
> Throw New Exception(sRetErrMsg & sRetErrMsgSub & vbCrLf &
> ex.ToString & vbCrLf)
> Finally
> '-> set return value
> CYCLE__GisData_ZIP_Add = Not bError
> End Try
> End Function
> '***************************************
**********************************
*************************
> All objects used are filled and the error occures on the
> cmdSQL.ExecuteNonQuery(). There is no SQL-Errornumber or something like
> that...
> Any ideas or hints are welcome!
> Cheers,
> Christoph
>

A severe error occurred on the current command

I get this weird error. Was wondering whether anyone could help here with fi
nding a solution.
SqlException: A severe error occurred on the current command. The results,
if any, should be discarded.
I'm using 2 SQL 2000 Servers. Server A and Server B. I have a Stored
Procedure on Server A that executes a Stored Procedure on Server B. What's o
dd is that i can run the Stored Procedure on Server A in Query Analyzer and
it works
great... as expected... but when i call it in ASP.NET (VB.NET), i get the se
vere error
message.
Can you help me here with what is causing this and how can I get over with t
his error.
Thanks
Reji
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...Reji,
That error is being produced by ADO.NET, not by SQL Server. It's a
SqlException... Have you tried debugging your call to the stored procedure?
You might want to post this question in an ADO.NET specific group, or
perhaps microsoft.public.dotnet.languages.vb.data would be more helpful.
"Reji" <am_saved@.yahoo.com> wrote in message
news:%23wkbf%23BaEHA.3888@.TK2MSFTNGP10.phx.gbl...
> I get this weird error. Was wondering whether anyone could help here with
finding a solution.
> SqlException: A severe error occurred on the current command. The results,
> if any, should be discarded.
> I'm using 2 SQL 2000 Servers. Server A and Server B. I have a Stored
> Procedure on Server A that executes a Stored Procedure on Server B. What's
odd is that i can run the Stored Procedure on Server A in Query Analyzer and
it works
> great... as expected... but when i call it in ASP.NET (VB.NET), i get the
severe error
> message.
> Can you help me here with what is causing this and how can I get over with
this error.
> Thanks
> Reji
>
> ****************************************
******************************
> Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...|||Thanks much Adam. Appreciate the help. Have posted the same in the forum you
said. Hope some one would answer me.
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...|||See whether this KBA http://support.microsoft.com/defaul...;82736
6 is any help to resolve.
--
--
Satya SKJ
"Adam Machanic" wrote:

> Reji,
> That error is being produced by ADO.NET, not by SQL Server. It's a
> SqlException... Have you tried debugging your call to the stored procedure
?
> You might want to post this question in an ADO.NET specific group, or
> perhaps microsoft.public.dotnet.languages.vb.data would be more helpful.
>
> "Reji" <am_saved@.yahoo.com> wrote in message
> news:%23wkbf%23BaEHA.3888@.TK2MSFTNGP10.phx.gbl...
> finding a solution.
> odd is that i can run the Stored Procedure on Server A in Query Analyzer a
nd
> it works
> severe error
> this error.
> ASP.NET resources...
>
>

Friday, February 24, 2012

A query runs 1 times slower from a .NET application the from Query

Just a guess.
It might be the delay in creating and opening the connection.
Why don't you log the current time just before calling the SP and after it
and find the time difference. That can narrow down on what the issue is.
--
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/
"Boaz Ben-Porat" wrote:

> Computer: 3.4 Ghz CPU, 1 GB RAM, 2003 Server
> database : MS SqlServer 2000 Enterprise. ~ 10 GB database file. Largest
> table in the database contains 11,000,000 records.
> Framework: .NET 2.0
> I try to run a query against the database, selecting aggregated data from
> views based on the large table.
> When executed from the Query Analizer, it takes 13 seconds.
> When executed from a .NET application, it takes 140 seconds.
> The database is well tuned (or else the query analizer would go slowly), s
o
> I can't find the reason for this difference.
> Any suggestion ?
> TIA
> Boaz Ben-Porat
> Milestone Systems
>
>Thanks for a quick answer.
The time I refer to is after the connection is opened.
the relevant code:
DbDataReader dr = null;
try
{
// This method opens a connection, if not allready opened
Connect();
// dbCommand is an input parameter of type DbCommand. It contains the SQL
statement
dbCommand.Connection = _connection;
DateTime t1 = DateTime.Now;
dr = dbCommand.ExecuteReader();
DateTime t2 = DateTime.Now;
TimeSpan ts = t2 - t1;
int milli = (int)ts.TotalMilliseconds; // milli contains the execution time
of dbCommand.ExecuteReader();
Boaz Ben-Porat
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:49A213DD-227B-4602-81ED-5ADF4E32687E@.microsoft.com...
> Just a guess.
> It might be the delay in creating and opening the connection.
> Why don't you log the current time just before calling the SP and after it
> and find the time difference. That can narrow down on what the issue is.
> --
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>
> "Boaz Ben-Porat" wrote:
>