Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select Error

Author  Topic 

Pao-Pao
Starting Member

3 Posts

Posted - 2004-06-03 : 21:37:15
I did a query statement in c# but the number of rows returned by the query is less than the number of rows when i run the query in query analyzer... how was this possible? the select statement carries the same condition....

SQLSelectAgent.CommandText = "SELECT tblAgentConfig.Tenant_Num, tblAgentConfig.Agent_Num, tblAgentConfig.Agent_Group_Num, tblAgentConfig.Agent_Name, tblAgentConfig.Agent_Init, tblAgentStatus.Logon_Time, tblAgentStatus.Current_Mode, tblAgentStatus.Time_Current_Mode, tblAgentStatus.ACD_Call_Count, tblAgentStatus.ACC_Talk_Time, tblAgentStatus.ACC_Work_Time, tblAgentStatus.ACC_Break_Time, tblAgentStatus.AHT FROM tblAgentConfig JOIN tblAgentStatus ON tblAgentConfig.Agent_Num = tblAgentStatus.AgentNum_FK convert(char(10), [time_stamp], 101)BETWEEN '" + dateFormater(momment.Month, momment.Day - 1, momment.Year, "day") + "' AND '" + dateFormater(momment.Month, momment.Day, momment.Year, "day") + "'";

vito1281
Starting Member

12 Posts

Posted - 2004-06-03 : 21:50:29
A couple of things to consider/check...

1. Is the .net application connected to the same database instance? In our environment, we sometimes have multiple copies of a given db (for testing purposes), and the web.config can get changed around quite a bit. This is one of those "check that the power cord is plugged in" things.

2. Start up SQL Profiler, and see what query hits the server when you make a call from the .NET application. You should be able to compare that against the query analyzer query you were referring to.

See if that helps.

quote:
Originally posted by Pao-Pao

I did a query statement in c# but the number of rows returned by the query is less than the number of rows when i run the query in query analyzer... how was this possible? the select statement carries the same condition....

SQLSelectAgent.CommandText = "SELECT tblAgentConfig.Tenant_Num, tblAgentConfig.Agent_Num, tblAgentConfig.Agent_Group_Num, tblAgentConfig.Agent_Name, tblAgentConfig.Agent_Init, tblAgentStatus.Logon_Time, tblAgentStatus.Current_Mode, tblAgentStatus.Time_Current_Mode, tblAgentStatus.ACD_Call_Count, tblAgentStatus.ACC_Talk_Time, tblAgentStatus.ACC_Work_Time, tblAgentStatus.ACC_Break_Time, tblAgentStatus.AHT FROM tblAgentConfig JOIN tblAgentStatus ON tblAgentConfig.Agent_Num = tblAgentStatus.AgentNum_FK convert(char(10), [time_stamp], 101)BETWEEN '" + dateFormater(momment.Month, momment.Day - 1, momment.Year, "day") + "' AND '" + dateFormater(momment.Month, momment.Day, momment.Year, "day") + "'";

Go to Top of Page
   

- Advertisement -