- Joined
- Oct 17, 2006
- Messages
- 1
- Reaction score
- 0
I have the following code, nothing out of the ordinary.
string conn = "integrated security=SSPI;Trusted_Connection=Yes;server=server;database=Datawarehouse";
SqlConnection conn1 = new SqlConnection(conn);
try
{
conn1.Open();
eventLog.WriteEntry("Opened Connection");
}
catch(Exception e45)
{
eventLog.WriteEntry("Error: " + e45.Message,System.Diagnostics.EventLogEntryType.Error);
}
CultureInfo culture = new CultureInfo( "en-US" );
string query56 = "SELECT EventName, WKS, Data, EventTime FROM DW_DataWarehouse WHERE EventName='Logon'";
SqlCommand myCommand = new SqlCommand(query56, conn1);
SqlDataReader reader = myCommand.ExecuteReader();
string opsdate1, endtime1, duration1, eventname1, data1, wks1, starttime1, signin1, airline1, terminal1;
int counter=0;
while (reader.Read())
{
counter = counter+1;
eventname1 = reader["EventName"].ToString().Trim();
data1 = reader["Data"].ToString().Trim();
wks1 = reader["WKS"].ToString().Trim();
starttime1 = reader["EventTime"].ToString().Trim();
int spaceposition = starttime1.IndexOf(" ");
opsdate1 = starttime1.Substring(0, spaceposition);
int usernameposition = data1.IndexOf("UserName=");
int firstquote1 = data1.Substring(usernameposition + 10, 10).IndexOf("\"");
signin1 = data1.Substring(usernameposition + 10, firstquote1);
terminal1 = wks1.Substring(3,1);
eventLog.WriteEntry("SqlDataReader, reader = " +reader.HasRows.ToString());
eventLog.WriteEntry("Workstation: " + wks1 + " COUNTER: " + counter.ToString());
}
conn1.Close();
reader.Close();
The SQLDataReader only reads the first 11 rows returned by the query and then stops responding, ie: nothing shows up in the EventLog. Anyone know why this might be happening? Any help is greatly appreciated.
Thanks
string conn = "integrated security=SSPI;Trusted_Connection=Yes;server=server;database=Datawarehouse";
SqlConnection conn1 = new SqlConnection(conn);
try
{
conn1.Open();
eventLog.WriteEntry("Opened Connection");
}
catch(Exception e45)
{
eventLog.WriteEntry("Error: " + e45.Message,System.Diagnostics.EventLogEntryType.Error);
}
CultureInfo culture = new CultureInfo( "en-US" );
string query56 = "SELECT EventName, WKS, Data, EventTime FROM DW_DataWarehouse WHERE EventName='Logon'";
SqlCommand myCommand = new SqlCommand(query56, conn1);
SqlDataReader reader = myCommand.ExecuteReader();
string opsdate1, endtime1, duration1, eventname1, data1, wks1, starttime1, signin1, airline1, terminal1;
int counter=0;
while (reader.Read())
{
counter = counter+1;
eventname1 = reader["EventName"].ToString().Trim();
data1 = reader["Data"].ToString().Trim();
wks1 = reader["WKS"].ToString().Trim();
starttime1 = reader["EventTime"].ToString().Trim();
int spaceposition = starttime1.IndexOf(" ");
opsdate1 = starttime1.Substring(0, spaceposition);
int usernameposition = data1.IndexOf("UserName=");
int firstquote1 = data1.Substring(usernameposition + 10, 10).IndexOf("\"");
signin1 = data1.Substring(usernameposition + 10, firstquote1);
terminal1 = wks1.Substring(3,1);
eventLog.WriteEntry("SqlDataReader, reader = " +reader.HasRows.ToString());
eventLog.WriteEntry("Workstation: " + wks1 + " COUNTER: " + counter.ToString());
}
conn1.Close();
reader.Close();
The SQLDataReader only reads the first 11 rows returned by the query and then stops responding, ie: nothing shows up in the EventLog. Anyone know why this might be happening? Any help is greatly appreciated.
Thanks
Last edited: