I have windows service that’s select some records. And it works like this:
using (SqlConnection conn = new SqlConnection(CMS.SettingsProvider.SqlHelperClass.ConnectionString))
{
conn.Open();
SqlCommand command = new SqlCommand("SELECT...", conn);
SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
<snip>
build item IDs to update
}
UpdateRecords(conn, itemIDs);
}
}
EDIT
Update function:
private void UpdateRecords(SqlConnection Connection, List<int> ItemIDs)
{
SqlCommand command = new SqlCommand("update table...", Connection);
command.ExecuteNonQuery();
}
I installed it as windows service in QA server and it updated records. In production server it’s not updating records. Log indicates update procedure is not even called. What could be the reason?
Thanks!
Preventive Action
Sample Reference
SQL SERVER – Introduction to SQL Server 2008 Profiler
Corrective Actions/Code Corrections
Inbuilt SQL SERVER Profiler ScreenShot