Corrupted query  witdh dataadapter.fill?

After using the ODP.NET driver (both) 9.2.0.4 and 9.2.0.2.102 for a while, we hit a problem today on 2 clients simulaneuously (new in-dev code, so maybe due to a recent change in our code).
The strange thing that happened (seen in sqlnet trace file) is that the query is transmitted with a corrupted character: the query is below. Note the '^' in 'part^source'. Should have been 'part_source'. Altough there are some things added dynamically to the query, the 'part_source' part is hardcoded. Has anyone seen something like this using ODP.NET?
Full query here:
SELECT part_no , description , base_uom , part^source , base_conv_factor , base_to_unit , part_type , date_imported , changed_date , alt_part_no , obsolete FROM part WHERE (part_no =:1) ORDER BY part_no ASC
Executed using:
' Create the DataAdapter & DataSet
lDa = New OracleDataAdapter(lCmd)
' Fill the DataSet using default
' values for DataTable names, etc.
lDa.Fill(lDt)
If aWithSchema = True Then
     lDa.MissingSchemaAction = MissingSchemaAction.Add
     lDa.FillSchema(lDt, SchemaType.Source)
End If

Below is the ODP.NET trace...
cirumstances:
we have a library of queries (datalayer) that are being called from within an ASP.NET app. The queries work fine for a while, but after some time a couple of queries get garbled in the DA.Fill. In the debugger, the query still looks find up till the moment of DA.Fill, but then the column 'part_source' becomes 'part^source'. There are manipulations with stringbuilder before that, but this part of the query is fixed in our code.
We have an operational version of our software running without this problem (but still on Framework 1.0, now we are at Framework 1.1). We have it both with 9.2.0.2102 and 9.2.0.4 ODP.NET vs. 9.2.0.1 Oracle DB (but since it's the Network send, I guess the target DB does not play a role in this problem).
Recreating this problem in a small testcase is not obvious as the same rahter generic code works for 100's of other queries without problems (even with the query that generates an issue). The problem goes away after iisreset.
TIME:2004/ 4/13-10:35:27: 6 TID: 768 OpsSqlExecuteNonQuery(): SQL: select parameter_data from interspc_cfg where section='interspec' and parameter='webversion'
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsSqlExecuteReader(): RetCode=0 Line=312
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsSqlAllocValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsSqlAllocValCtx(): RetCode=0 Line=137
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsMetCopyValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsMetCopyValCtx(): RetCode=0 Line=263
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsErrAllocCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsErrAllocCtx(): RetCode=0 Line=185
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacAllocValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacAllocValCtx(): RetCode=0 Line=241
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleCommand::ExecuteReader()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleDataReader::Read()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacRead()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacRead(): RetCode=0 Line=187
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleDataReader::Read()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleCommand::ExecuteScalar()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleDataReader::GetValue()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleDataReader::IsDBNull()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacGetInd()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacGetInd(): RetCode=0 Line=566
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleDataReader::IsDBNull()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleDataReader::GetString()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacGetType()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacGetType(): RetCode=0 Line=685
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleDataReader::GetString()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleDataReader::GetValue()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacDispose()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacFreeCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacFreeCtx(): RetCode=0 Line=353
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsDacFreeValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacFreeValCtx(): RetCode=0 Line=289
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsSqlFreeCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsSqlFreeCtx(): RetCode=0 Line=105
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsMetFreeValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsMetFreeValCtx(): RetCode=0 Line=131
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsDacDispose(): RetCode=0 Line=438
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleParameterCollection::Clear()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleParameterCollection::Clear()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleParameter::OracleParameter(2)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsPrmAllocValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsPrmAllocValCtx(): RetCode=0 Line=131
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleParameter::OracleParameter(2)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleCommand::OracleCommand(1)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleCommand::OracleCommand(1)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleCommand::CommandText(): set
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleCommand::CommandText(): set
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleParameterCollection::Add(2)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleParameterCollection::Add(2)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OracleDataAdapter::OracleDataAdapter(2)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OracleDataAdapter::OracleDataAdapter(2)
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsPrmResetValCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsPrmResetValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsSqlExecuteReader()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsErrAllocCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsErrAllocCtx(): RetCode=0 Line=185
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (ENTRY) OpsSqlAllocCtx()
TIME:2004/ 4/13-10:35:27: 16 TID: 768 (EXIT) OpsSqlAllocCtx(): RetCode=0 Line=80
TIME:2004/ 4/13-10:35:27: 16 TID: 768 OpsSqlExecuteNonQuery(): SQL: SELECT part_no , description , base_uom , part^source , base_conv_factor , base_to_unit , part_type , date_imported , changed_date , alt_part_no , obsolete FROM part WHERE (part_no =:1) ORDER BY part_no ASC
TIME:2004/ 4/13-10:35:27: 36 TID: 768 (EXIT) OpsSqlExecuteReader(): RetCode=-1 Line=308
TIME:2004/ 4/13-10:35:27: 46 TID: 768 (ENTRY) OpsErrGetOpoCtx()
TIME:2004/ 4/13-10:35:27: 46 TID: 768 (ERROR) Oracle error code=923
TIME:2004/ 4/13-10:35:27: 46 TID: 768 (EXIT) OpsErrGetOpoCtx(): RetCode=0 Line=125
TIME:2004/ 4/13-10:35:36:941 TID: 768 (ENTRY) OracleConnection::Close()
TIME:2004/ 4/13-10:35:36:941 TID: 768 (ENTRY) OpsConClose()
TIME:2004/ 4/13-10:35:36:961 TID: 768 (EXIT) OpsConClose(): RetCode=0 Line=562
TIME:2004/ 4/13-10:35:36:961 TID: 768 (EXIT) OracleConnection::Close()
TIME:2004/ 4/13-10:35:36:961 TID: 768 (ENTRY) OracleConnection::Dispose()
TIME:2004/ 4/13-10:35:36:961 TID: 768 (ENTRY) OpsConDispose()
TIME:2004/ 4/13-10:35:36:961 TID: 768 (ENTRY) OpsConFreeValCtx()
TIME:2004/ 4/13-10:35:36:961 TID: 768 (EXIT) OpsConFreeValCtx(): RetCode=0 Line=587
TIME:2004/ 4/13-10:35:36:961 TID: 768 (EXIT) OpsConDispose(): RetCode=0 Line=697
TIME:2004/ 4/13-10:35:36:961 TID: 768 (EXIT) OracleConnection::Dispose()
TIME:2004/ 4/13-10:35:42:330 TID: 768 (ENTRY) OracleConnection::OracleConnection(2)
TIME:2004/ 4/13-10:35:42:330 TID: 768 (EXIT) OracleConnection::OracleConnection(2)
TIME:2004/ 4/13-10:35:42:330 TID: 768 (ENTRY) OracleConnection::Open()
TIME:2004/ 4/13-10:35:42:330 TID: 768 (ENTRY) OpsConAllocValCtx()
TIME:2004/ 4/13-10:35:42:330 TID: 768 (EXIT) OpsConAllocValCtx(): RetCode=0 Line=129
TIME:2004/ 4/13-10:35:42:330 TID: 768 (ENTRY) OpsConOpen()
TIME:2004/ 4/13-10:35:42:510 TID: 768 (ENTRY) OpsConClose()
TIME:2004/ 4/13-10:35:42:530 TID: 768 (EXIT) OpsConClose(): RetCode=0 Line=562
TIME:2004/ 4/13-10:35:42:530 TID: 768 (ENTRY) OpsConDispose()
TIME:2004/ 4/13-10:35:42:530 TID: 768 (EXIT) OpsConDispose(): RetCode=0 Line=697
TIME:2004/ 4/13-10:35:42:530 TID: 768 (ENTRY) OpsErrGetOraMesg()
TIME:2004/ 4/13-10:35:42:540 TID: 768 (EXIT) OpsErrGetOraMesg(): RetCode=0 Line=298
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsSqlFreeCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsSqlFreeCtx(): RetCode=0 Line=105
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsPrmFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsPrmFreeValCtx(): RetCode=0 Line=297
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsSqlFreeValCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsSqlFreeValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:42:870 TID: 788 (ENTRY) OpsErrFreeCtx()
TIME:2004/ 4/13-10:35:42:870 TID: 788 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=212
TIME:2004/ 4/13-10:35:46:756 TID: 768 (ENTRY) OracleConnection::OracleConnection(2)
TIME:2004/ 4/13-10:35:46:756 TID: 768 (EXIT) OracleConnection::OracleConnection(2)
TIME:2004/ 4/13-10:35:46:756 TID: 768 (ENTRY) OracleConnection::Open()
TIME:2004/ 4/13-10:35:46:756 TID: 768 (ENTRY) OpsConAllocValCtx()
TIME:2004/ 4/13-10:35:46:756 TID: 768 (EXIT) OpsConAllocValCtx(): RetCode=0 Line=129
TIME:2004/ 4/13-10:35:46:756 TID: 768 (ENTRY) OpsConOpen()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OpsConOpen(): RetCode=0 Line=1354
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OracleConnection::Open()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OracleParameter::OracleParameter(4)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OpsPrmAllocValCtx()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OpsPrmAllocValCtx(): RetCode=0 Line=131
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OracleParameter::OracleParameter(4)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OracleCommand::OracleCommand(1)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OracleCommand::OracleCommand(1)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OracleCommand::CommandText(): set
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OracleCommand::CommandText(): set
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OracleParameterCollection::Add(2)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OracleParameterCollection::Add(2)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OracleDataAdapter::OracleDataAdapter(2)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OracleDataAdapter::OracleDataAdapter(2)
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OpsPrmResetValCtx()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OpsPrmResetValCtx(): RetCode=0 Line=154
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OpsSqlExecuteReader()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OpsErrAllocCtx()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OpsErrAllocCtx(): RetCode=0 Line=185
TIME:2004/ 4/13-10:35:46:937 TID: 768 (ENTRY) OpsSqlAllocCtx()
TIME:2004/ 4/13-10:35:46:937 TID: 768 (EXIT) OpsSqlAllocCtx(): RetCode=0 Line=80
TIME:2004/ 4/13-10:35:46:937 TID: 768 OpsSqlExecuteNonQuery(): SQL: SELECT user_id , user_initials , last_name , forename , telephone_no , email_address , initial_profile , user_profile , limited_configurator , intl , plant_access , printing_allowed , reference_text , web_allowed , current_only , approved_only , override_part_val , prod_access , plan_access , phase_access , view_bom FROM application_user WHERE application_user.USER_ID = :userid

Similar Messages

  • Re: BI Erecruiting Query time-to-fill,

    Guys,
    I have activated the standard query time-to-fill, i am getting an error
    Value '-1' is invalid for property 'Ref. Characteristic' of element 'Time-to-Fill (Days)'
    I checked the exception aggregation, Under Exception aggregation points to use standard aggregation & ref. characteristics to -1. Now if i have to change the ref. characteristics what value i have to choose.
    this is the formula used for CKF 'Time-to-Fill (Days)'
    Candidacy Status == 3 * candidacy start date - requisition creation date.
    technical Name: 0ERC_ IS02_Q0001
    Regards,
    Anand
    Edited by: araj123 on Oct 14, 2010 9:53 PM

    Hi,
    How did you solve this problem ? Or what did you do to make this query work ?
    Thank you!

  • DataAdapter.Fill doesn't include PrimaryKey Info

    We are using Oracle 9i and Odp.net verion 9.2.0.401.
    I am using the data adapter on a command that is a simple select statement in our code. The code is written generically to support multiple providers using ado.net.
    The problem I am having is that when I call Fill with "adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey" specified that DataTable comes back with no primary key. Other providers bring this information back.
    I read in the manual that indicates that "schema and key information is not brought back even if MissingSchemaAction = MissingSchemaAction.AddWithKey is specified". This seem to function a bit different than other providers (both SqlServer and Oracle).
    How would I load this info when I load the table using fill?
    Thanks in advance
    Sample of our code:
    public static DataTable LoadTable(string name)
    IDbTransaction transaction = null;
    IDbConnection connection = null;
    DataSet dataSet = new DataSet();
    string query = string.Format("SELECT * FROM {0}", name);
    DataTable tableToReturn = null;
    try
    OpenConnection(out connection, out transaction);
    IDbCommand command = InterfaceDataProvider.CreateCommand(transaction.Connection, transaction, query);
    DbDataAdapter adapter = InterfaceDataProvider.CreateAdapter(command);
    adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    adapter.Fill(dataSet, name);
    tableToReturn = dataSet.Tables[name];
    finally
    CloseConnection(connection);
    return tableToReturn;

    It's unfortunate that the OracleDataAdapter doesn't retrieve this information. Anyway, here's how to do it yourself:
      static void derivePK(DataTable t, string name, OracleConnection con)
        OracleCommand c = new OracleCommand(@"select column_name
                                                from user_cons_columns ucc,
                                                user_constraints uc 
                                                where  ucc.constraint_name =  uc.constraint_name
                                                and    uc.constraint_type = 'P'
                                                and uc.table_name = upper(:1) order by ucc.position",con);
        cmd.Parameters.Add("name",name);
        System.Collections.ArrayList keyColumnList = new System.Collections.ArrayList();
        using (OracleDataReader r = c.ExecuteReader()) 
        while (r.Read())
          keyColumnList.Add(t.Columns[(string)r[0]]);
        DataColumn[] keyColumns = (DataColumn[])keyColumnList.ToArray(typeof(DataColumn));
        t.PrimaryKey = keyColumns;
      }David

  • I need db block corruption query

    Hi all,
    In my database some of the blocks are corrupted.
    seelect * from v$database_block_corruption;
    31 rows selected.
    i need to find which object_name,owner,blocks,file_id are corrupted details.
    please send the query.
    Regards
    Rajabaskar

    RajaBaskar Thangaraj wrote:
    i need to find which object_name,owner,blocks,file_id are corrupted details.
    please send the query.
    Use the dbverify tool to give you the block corruption ,owner,block etc
    $ dbv file=/u01/app/oracle/oradata/testdb/users01.dbf blocksize=8192
    Hope that helps
    http://www.dba-oracle.com/tips_oracle_dbv_verify.htm

  • Portal Report from SQL query will not fill the page irrespective of column width.....

    I'm displaying a report in a portal and if you run in full screen the table does not fill the page.
    I can change the column width from xx percent to xx pixel and nothing makes a difference
    any ideas?

    Hi,
    Which version of portal are you using. This is a bug. It has been fixed in 30984.
    Thanks,
    Sharmila

  • Corrupted query statement in MySQL

    Occasionaly queries are truncated resulting in an error. The
    problem is not repeatable, the same query runs fine for a long time
    and then suddenly it gets truncated. It doesnt appear with a
    specific query but randomly.
    An example:
    SELECT * from tablename
    Is run like
    LECT * from tablename
    Truncation appears at the start of the string as well as at
    the end.
    We are using MX7.0.1 (multi-server cluster, enterprise
    edition) with a MySQL 4.0.2 database (MysQL 3.x connector).
    Analysis of the logs shows that we first had this problem
    when we moved from the Professional to the Enterprise Edition, and
    the problem only occurs when there is a heavy load on the
    machines.

    Hi,
    I assume you have already written a query to get the lecturers,
    What you need to do is, create a parameter of type string, right click to edit it. Click on Defualt Values, you will get a window Set Default values, Select the command/table from the first drop down, select the field in your case lecturer from the second drop down, When you do that all the values will be listed on the left side, Select all of them and push into the right list by clicking the > sign. Click Ok and uncheck the Allowe editing the defualt values check box and click Ok, please note that the values will have to be reset if there is a change in the db query.
    Hope this helps,
    Thanks
    -Azhar

  • Data provider internal error(-3000)  during DataAdapter.Fill

    I get this error sporadically.
    From other messages on this forum, it seems others are having similar problems. It appears the Oracle staff
    is still struggling to identify and fix (or did I miss a post?)
    I hope the next release can include some more informative diagnostic error messages. (no judgment implied, just a suggestion).
    But I need this to work, so I'm posting my
    info as well in hopes it will help.
    Sorry for the length, but I think all the detail may be needed to diagnose.
    I have been using ODP.Net for weeks without trouble
    until recently. I just added a CLOB field to my table yesterday, and
    the problem started. I don't know whether that's cause or coincidence.
    Possible workarounds I will try:
    1) Explicit select of columns rather than select *
    2) Retry once on failure after short delay
    Below, I'm including the exception message from the ASP.Net page.
    It occurs at the same spot in my code, but often
    it works fine. Now, an hour later, I cannot repeat the problem.
    I've edited the "Source Error" section to
    provide more of the code, so you can see the full context.
    I've also pasted the stored procedure called so you can see what that is about.
    I need this to work, so feel free to contact me if you need further information
    to diagnose this in order to fix it.
    I go live on March 7, so if I don't get a fix soon and can't find
    a workaround, I'll just make a lame error message like "Site is very busy, please try again".
    Even though the site is NOT busy. But having them try again seems to work.
    And I don't want to tell them why I'm asking them to try again <grin>.
    I am thinking of putting a try/catch block and sleeping for a second and then trying one more
    time in my code. I'll let you know if that is an effective work-around.
    David Kreth Allen
    University of Minnesota
    Carlson School of Management
    [email protected] remove XYZ to send emails
    612-625-0386
    <WebPageError>
    Server Error in '/ScholarshipApplicationWeb' Application.
    Data provider internal error(-3000)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: Oracle.DataAccess.Client.OracleException: Data provider internal error(-3000)
    Source Error:
         OracleCommand cmd = new OracleCommand();
         cmd.Connection = new OracleConnection(
              ApplicationEnvironment.current.database.OracleConnectionString);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "pkg_batch.get_details";
         cmd.Parameters.Add("batch_id",OracleDbType.Int32,
              batchId,ParameterDirection.Input);
         cmd.Parameters.Add("batchCursor",OracleDbType.RefCursor,
              DBNull.Value,ParameterDirection.Output);
         cmd.Parameters.Add("majorsCursor",OracleDbType.RefCursor,
              DBNull.Value,ParameterDirection.Output);
         cmd.Parameters.Add("detailCursor",OracleDbType.RefCursor,
              DBNull.Value,ParameterDirection.Output);
         OracleDataAdapter da = new OracleDataAdapter(cmd);
         DataSet ds = new DataSet("batches");
         da.Fill(ds);
         DataTable dt = ds.Tables[0];
         dt.TableName = "batch";
    Source File: C:\Projects\ScholarshipSolution\ScholarshipLibrary\Data\ScholarshipApplicationBatch.cs Line: 329
    Stack Trace:
    [OracleException: Data provider internal error(-3000)]
    Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, IntPtr opsSqlCtx, Object src, String procedure, String[] args)
    Oracle.DataAccess.Client.OracleDataReader.NextResult() +1259
    System.Data.Common.DbDataAdapter.FillNextResult(IDataReader dataReader) +98
    System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +261
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +129
    Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +516
    Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +290
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
    CSOM.ScholarshipLibrary.Data.ScholarshipApplicationBatch.getDataById(Int32 batchId) in C:\Projects\ScholarshipSolution\ScholarshipLibrary\Data\ScholarshipApplicationBatch.cs:329
    CSOM.ScholarshipLibrary.Data.ScholarshipApplicationBatch.GetById(Int32 batchId) in C:\Projects\ScholarshipSolution\ScholarshipLibrary\Data\ScholarshipApplicationBatch.cs:290
    CSOM.ScholarshipApplicationWeb.BatchSummaryControl.Edit_Click(Object sender, CommandEventArgs e) in c:\inetpub\wwwroot\ScholarshipApplicationWeb\BatchSummaryControl.cs:68
    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +110
    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
    System.Web.UI.Page.ProcessRequestMain() +1244
    Version Information: Microsoft .NET Framework Version:1.0.3705.288; ASP.NET Version:1.0.3705.288
    </WebPageError>
    <PackageBody>
    PROCEDURE GET_DETAILS(
    p_batch_id IN number,
    batchCursor OUT pkg_batch.refcur,
    majorsCursor OUT pkg_batch.refcur,
    applicationsCursor OUT pkg_batch.refcur
    IS
    BEGIN
    OPEN batchCursor FOR SELECT
    * FROM scholarshipApplicationBatch
    where scholarshipApplicationBatch_id = p_batch_id;
    OPEN majorsCursor FOR SELECT
    * FROM major_response
    where batch_id = p_batch_id;
    OPEN applicationsCursor FOR SELECT
    * FROM schol_detail
    where batch_id = p_batch_id;
    END GET_DETAILS;
    </PackageBody>

    One workaround that seems to work is to retry in a loop.
    Sample code is pasted below.
    Obviously it may still fail, but less often.
    I'll report any further changes that affect
    the behavior in hopes it will assist the Oracle staff in
    fixing it.
    <CODE>
    try
    da.Fill(ds);
    catch (OracleException excp)
         const int maxTrys = 5;
         int failureCount = 1;
         bool succeeded = false;
         for (int i = 0;i<maxTrys;i++)
              try
                   System.Threading.Thread.Sleep(
                        TimeSpan.FromSeconds(1));
                   ds.Clear();
                   da.Fill(ds);
                   i = maxTrys;
                   succeeded = true;
              }//try
              catch
                   failureCount ++;
         }//for
         errorHandler.Report(
              String.Format(
              "Failure in da.Fill in ScholAppBatch. " +
              " Failed {0} times. Finally Succeeded = {1}.",
                                            failureCount.ToString(),
         succeeded.ToString()),
              excp);
    }//catch
    </CODE>

  • Corrupted Query

    Hello, I am having an issue with deleting my query.  It was created in 7.0 QD.  Now when I try to open it up it won't open and asks to close the QD.  I then tried to delete is in RSZDELETE and got the following message:
    "Query object D4KOG9TVDIFBUXABDH8MSQJ02 is blocked. Deletion has been cancelled."
    Query Object is the query itself.
    This is in DEV.  I saw a couple of posts but no one really posted a solution for this.  I even tried to go into RSREPDIR and tried to delete it from there.  It said it got deleted but I am still not able save another query with this name. 
    Let me know if anyone has a solution.
    Thanks, Syed.

    Just to add.  I went through all the tables and delete this name "D4KOG9TVDIFBUXABDH8MSQJ02" manually.  There is a table for reference
    RSZELTXREF
    in which I see about 24 entries with this same technical names, under Layout type of element they are defined as  VAR, SHT, SOB.  I am hesitent to delete these entries.  Does anyone know what they are.
    Each of these entries has a different TELTUID name though. 
    Thanks,
    Syed.

  • Corrupted Query Designer with strange External Restriction

    Dear Experts,
    I have a dilemma with query, when I run the query in RSRT and debug it with OLAP, in the restriction side it appears to restrict the query with two Attributes which are not even used in my query not also their master-data.
    I have created the same query again but still it gave the same behavior.
    Please help me to remove this dilemma.
    Regards,
    Mohammed

    close all applications re-use RSRT
    hope it works

  • Dataadapter Fill() is inserting comma in varchar2

    Howdy,
    How do I turn this behavior off?
    Yes, the contents of the varchar2 column "looks" like a number (ie 3001, 4002 etc)
    and yes some of the columns contain alphas.
    Honest, the dataset's datatable column shows this correctly as a "string" type.
    Honest, the data stored in the table does NOT contain any comma.
    dennis

    Look at the read demo in the link
    http://www.psoug.org/reference/utl_file.html
    http://www.devshed.com/c/a/Oracle/Reading-Text-Files-using-Oracle-PLSQL-and-UTLFILE/1/

  • Save and close excel file using C#.

    I am not sure why I get the following error for the below code.  Everything seems to work otherwise.
    Error found: System.Runtime.InteropServices.COMException (0x8002000B): Invalid index. (Exception from HRESULT: 0x8002000
    B (DISP_E_BADINDEX))
    Application _application;public void CloseFile(string filename, bool isSaveChanges)
    _application.Workbooks[filename].Close(SaveChanges: isSaveChanges);

    I' work with excel files with connection you can save data and  close connection Easy.
     //connection String for xls file format.
                        if (fileExtension == ".xls")
                            excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                        //connection String for xlsx file format.
                        else if (fileExtension == ".xlsx")
                            excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                        //Create Connection to Excel work book and add oledb namespace
                        OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
                        excelConnection.Open();
    DataTable dt = new DataTable();
                        dt = excelConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                        if (dt == null)
                            return null;
                        String[] excelSheets = new String[dt.Rows.Count];
                        int t = 0;
                        //excel data saves in temp file here.
                        foreach (DataRow row in dt.Rows)
                            excelSheets[t] = row["TABLE_NAME"].ToString();
                            t++;
                        OleDbConnection excelConnection1 = new OleDbConnection(excelConnectionString);
                        string query = string.Format("Select * from [{0}]", excelSheets[0]);
                        using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, excelConnection1))
                            dataAdapter.Fill(ds);
    Best Regards
    Hakim.

  • Pre-fill the OLAP cache for a query on Data change event  of infoprovider

    Hi Gurus,
    I have to pre-fill the OLAP cache for a query,which has bad performance.
    I read a doc 'Periodic Jobs and Tasks in SAP BW'
    which suggested sum steps to do this
    i hav created the setting for Bex broadcasting for scheduling job Execution with data change in info provider
    thereafter doc says  "an event has to be raised in the process chain which loads the data to this InfoProvider.When the process chain executes the process u201CTrigger Event Data Change (for Broadcaster)u201D, an event is raised to inform the Broadcaster that the query can be filled in the OLAP cache."
    how can this b done please provide with sum proper steps
    Answers are always appreciated.
    Thanks.

    Hi
    U need to create a process chain or use the existing process chain which you are using to load your current solution, just add event change process type in the process chian  and inside it add the info provider which are going to be affected.
    Once you are done with this go to the broadcaster  and  create new setting for that query...you will see the option for event data chainge in infoprovider just choose that  and create the settings.
    hope it helps

  • OdbcDataAdapter.Fill() not getting all rows from RDB using 64bit driver

    I am using VS2012 Pro on Windows 7 (64-bit). I am migrating an older 32-bit VS2008 app to the new environment. I'm building for the .NET Framework 4.5.
    The app queries an RDB database and uses the Oracle RDB drivers version 3.3.2.0. When I build as a 32-bit app and use the 32-bit Oracle RDB Driver, the query succeeds and returns all 341 data rows. When I built it as 64-bit and use the 64-bit driver, I only
    get the first 101 rows.
    Oracle says the problem is in the OdbcDataAdapter.Fill() method. I was able to confirm this. I created an OdbcDataReader and used the debugger to see what was being read, I can see all 341 rows, but when I use the DataAdapter.Fill (or DataSet.Load) method,
    the results are truncated to 101 rows. Changing the SQL to query different tables does not change the problem. Below is a code sample:
            private DataSet runQuery()
                string connString32 = @"PROVIDER=MSDASQL;DRIVER={Oracle RDB Driver};SVR=myserver;DATABASE=ATTACH 'filename mydatabase';CLS=myclassname;uid=myusername;pwd=mypassword;xpt=2";
                string connString64 = @"PROVIDER=MSDASQL;DRIVER={Oracle RDB Driver 64 Bit};SVR=myserver;DATABASE=ATTACH 'filename mydatabase';CLS=myclassname;uid=myusername;pwd=mypassword;xpt=2";
                string sql = "SELECT person_id FROM person_tab";      
                DataSet ds = new DataSet();
                using (OdbcConnection conn = new OdbcConnection(connString64))  
                    OdbcCommand cmd = new OdbcCommand(sql, conn);
                    OdbcDataAdapter da = new OdbcDataAdapter();
                    da.SelectCommand = cmd;
                    conn.Open();
                    da.Fill(ds, "myDataSet");
                return ds;
    Has anyone else encountered this problem? If so, how did you get around it?

    Hello,
    Since I do not have the RDB database, I made a test with both 32bit and 64bit ODBC Driver 11 for SQL Server and query for 1000 records, however, both of them can work fine.
    As far as I know, the ODBC is just a component as a bridge to connect the driver and the application and since you are use the Oracle RDB driver, I suggest you posting it to the Oracle forum:
    https://community.oracle.com/community/developer/english
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • OracleConnection no need to open connection to query a stored proc

    I discovered something I would it strange today. As I was looking at my colleague code, I found that when whe query a stored proc, there's no need to open the connection before the instruction dataAdapter fill.
    here's the example
    Public Function getCodeBiensNi() As List(Of CodeBiensNi)
    Dim CodeBiensNis As New List(Of CodeBiensNi)
    Try
    Dim cursCmd As OracleCommand = New OracleCommand("b240004k.get_bdm_code_biens_ni_2", connection)
    cursCmd.CommandType = CommandType.StoredProcedure
    Dim param0 As New OracleParameter
    param0.OracleDbType = OracleDbType.RefCursor
    param0.Direction = ParameterDirection.ReturnValue
    cursCmd.Parameters.Add(param0)
    Dim da As New OracleDataAdapter(cursCmd)
    Dim ds As New DataSet
    Dim unCodeBiensNi As CodeBiensNi
    da.Fill(ds)
    ' loop through the data set and display each table/row/column
    For Each dt As DataTable In ds.Tables
    For Each dr As DataRow In dt.Rows
    unCodeBiensNi = New CodeBiensNi With {.bcbn_code = dr.Item("bcbn_code"), _
    .bcbn_description = dr.Item("bcbn_description").ToString, _
    .bcbn_date_debut = dr.Item("bcbn_date_debut"), _
    .bcbn_date_fin = dr.Item("bcbn_date_fin")}
    CodeBiensNis.Add(unCodeBiensNi)
    Next
    Next
    ds.Dispose()
    da.Dispose()
    param0.Dispose()
    cursCmd.Dispose()
    Catch ex As Exception
    Throw New Exception("Erreur d'interrogation dans code biens ni. " + ex.Message)
    Finally
    End Try
    Return CodeBiensNis
    End Function
    connection is a private member that has a valid connection string but that's not open. ie. I didn't issue open.
    I even was on debug mode and all the time the state of connection is close.
    Although it work for store proc, it didn't work for simple SQL query. If issue something simple like "select 'toto' from dual", if I don't open the connection it doesn't work, it raise a exception.
    someone know why? I'm just too curious about that. Try to google it but i can't find the right keyword...

    Hi Vishal,
    Get the URL of the document you want to open.
    There are various API/FM  of DMS available for this.
    You can use ACFexecute UI elemnet for opening the document ( lIke PDF, word etc )  with this URL{ Available with NW Ehp 1}.
    or you can try using LinktoUrl element.
    Warm regards,
    Atul

  • SQL query to find all suites that are associated with automation

    I trying to incorporate CodeUI tests into a Release Mangement deployment template ... As a developer, I want to be able to specify a sub-tree of a test plan & only execute those test suites that are associated with automation.  Is there a way to
    extract all automated workitems and associated them with their respective test suites?
    Any assistance would be greatly appreciated!

    John,
    I've partially resolved the issue of executing a sub-set of suites with the following powershell implementation:
    1. Extract "potential" suite paths from a XML configuration file:
    <?xml version="1.0"?>
    <Configurations>
    <Properties>
    <Property key="DEFAULT" value="SuitePaths" />
    <Property key="DatabaseServer" value="MYDBSERVER" />
    <Property key="DatabaseInstance" value="Default" />
    <Property key="DatabaseName" value="TFS_DefaultCollection" />
    <Property key="ConfigurationName" value="US - Windows 7 and IE 10" />
    </Properties>
    <Notifications>
    <Notification key="0" value="[email protected]" />
    </Notifications>
    <SuitePaths>
    <SuitePath key="0" value="MyProject\WebProduct\Student\Features\Login" />
    <SuitePath key="1" value="MyProject\WebProduct\Student\Features\Logout" />
    </SuitePaths>
    <AreaPaths>
    <AreaPath key="0" value="MyProject\WebProduct\Student\Features\Login" />
    </AreaPaths>
    </Configurations>
    2. Extract record set of suites from TFS via SQL query:
    # FUNCTION: Retrieve-SuitePaths
    # Parameters:
    # (1.) LogFile -- Name of log file (e.g., C:\Temp or C:\Temp\DEPLOY_DatabaseServer_WebCMS2_DF06_20131031.6.log)
    # (2.) Connection -- Database connection
    # (3.) Paths -- Hash table of suite paths
    Function Retrieve-SuitePaths
    param
    [Parameter(Mandatory=$True)][String]$LogFile,
    [Parameter(Mandatory=$True)]$Connection,
    [Parameter(Mandatory=$True)]$Paths
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "Retrieve suite(s): " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    $SuitePaths = "("
    $Counter = 0
    foreach ($Key in $Paths.Keys)
    if ($Counter -gt 0)
    $SuitePaths = $SuitePaths + ", "
    $SuitePaths = $SuitePaths + "'" + $Paths.Get_Item($Key) + "'"
    $Counter += 1
    $SuitePaths = $SuitePaths + ")"
    # --DEBUG ONLY--> Write-Output "Paths: $SuitePaths" | Out-File -FilePath $LogFile -Append
    $Command = New-Object System.Data.SqlClient.SqlCommand
    $SQLStatement = "
    WITH
    cte_SuiteChildren
    AS
    -- Anchor definition to pull all certify modes
    SELECT
    S.[SuiteId],
    S.[ProjectId],
    PJ.ProjectName,
    S.[PlanId],
    P.[Name] AS PlanName,
    S.[ParentSuiteId],
    S.[SuitePath],
    CONVERT(NVARCHAR(256), NULL) AS ParentTitle,
    S.[Title],
    0 AS RecurseLevel
    FROM
    [dbo].[tbl_Suite] AS S
    INNER JOIN [dbo].[tbl_Plan] AS P ON S.PlanID = P.PlanID
    INNER JOIN [dbo].[tbl_Project] AS PJ ON S.ProjectID = PJ.ProjectID
    WHERE
    S.ParentSuiteID = 0
    UNION ALL
    -- Recursive member to pull details of certify sessions
    SELECT
    S.[SuiteId],
    S.[ProjectId],
    PJ.ProjectName,
    S.[PlanId],
    P.[Name] AS PlanName,
    S.[ParentSuiteId],
    S.[SuitePath],
    PS.[Title] AS ParentTitle,
    S.[Title],
    SC.[RecurseLevel] + 1 AS RecurseLevel
    FROM
    [dbo].[tbl_Suite] AS S
    INNER JOIN cte_SuiteChildren AS SC on SC.SuiteID = S.ParentSuiteID
    INNER JOIN [dbo].[tbl_Suite] AS PS ON SC.SuiteId = PS.SuiteId
    INNER JOIN [dbo].[tbl_Plan] AS P ON S.PlanID = P.PlanID
    INNER JOIN [dbo].[tbl_Project] AS PJ ON S.ProjectID = PJ.ProjectID
    cte_SuiteLevel_0
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[ProjectName] + '\' + SC.[PlanName] AS Path,
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 0
    cte_SuiteLevel_1
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 1
    cte_SuiteLevel_2
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 2
    cte_SuiteLevel_3
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 3
    cte_SuiteLevel_4
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 4
    cte_SuiteLevel_5
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 5
    cte_SuiteLevel_6
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 6
    cte_SuiteLevel_7
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 7
    cte_SuiteLevel_8
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 8
    cte_SuiteLevel_9
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 9
    cte_SuiteLevel_10
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 10
    cte_Suites
    AS
    SELECT
    SL0.[ProjectId],
    SL0.[PlanId],
    CASE
    WHEN SL2.ParentSuiteId IS NULL
    THEN SL1.ParentSuiteId
    ELSE CASE
    WHEN SL3.ParentSuiteId IS NULL
    THEN SL2.ParentSuiteId
    ELSE CASE
    WHEN SL4.ParentSuiteId IS NULL
    THEN SL3.ParentSuiteId
    ELSE CASE
    WHEN SL5.ParentSuiteId IS NULL
    THEN SL4.ParentSuiteId
    ELSE CASE
    WHEN SL6.ParentSuiteId IS NULL
    THEN SL5.ParentSuiteId
    ELSE CASE
    WHEN SL7.ParentSuiteId IS NULL
    THEN SL6.ParentSuiteId
    ELSE CASE
    WHEN SL8.ParentSuiteId IS NULL
    THEN SL7.ParentSuiteId
    ELSE CASE
    WHEN SL9.ParentSuiteId IS NULL
    THEN SL8.ParentSuiteId
    ELSE CASE
    WHEN SL10.ParentSuiteId IS NULL
    THEN SL9.ParentSuiteId
    ELSE SL10.ParentSuiteId
    END
    END
    END
    END
    END
    END
    END
    END
    END AS [ParentSuiteId],
    CASE
    WHEN SL2.SuiteId IS NULL
    THEN SL1.SuiteId
    ELSE CASE
    WHEN SL3.SuiteId IS NULL
    THEN SL2.SuiteId
    ELSE CASE
    WHEN SL4.SuiteId IS NULL
    THEN SL3.SuiteId
    ELSE CASE
    WHEN SL5.SuiteId IS NULL
    THEN SL4.SuiteId
    ELSE CASE
    WHEN SL6.SuiteId IS NULL
    THEN SL5.SuiteId
    ELSE CASE
    WHEN SL7.SuiteId IS NULL
    THEN SL6.SuiteId
    ELSE CASE
    WHEN SL8.SuiteId IS NULL
    THEN SL7.SuiteId
    ELSE CASE
    WHEN SL9.SuiteId IS NULL
    THEN SL8.SuiteId
    ELSE CASE
    WHEN SL10.SuiteId IS NULL
    THEN SL9.SuiteId
    ELSE SL10.SuiteId
    END
    END
    END
    END
    END
    END
    END
    END
    END AS [SuiteId],
    SL0.ProjectName,
    SL0.PlanName,
    --SL0.Path,
    --SL1.[Title],
    CASE
    WHEN SL2.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title
    ELSE CASE
    WHEN SL3.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title
    ELSE CASE
    WHEN SL4.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title
    ELSE CASE
    WHEN SL5.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title
    ELSE CASE
    WHEN SL6.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title
    ELSE CASE
    WHEN SL7.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title
    ELSE CASE
    WHEN SL8.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title
    ELSE CASE
    WHEN SL9.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title + '\' + SL8.Title
    ELSE CASE
    WHEN SL10.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title + '\' + SL8.Title + '\' + SL9.Title
    ELSE SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title + '\' + SL8.Title + '\' + SL9.Title + '\' + SL10.Title
    END
    END
    END
    END
    END
    END
    END
    END
    END AS Path,
    CASE
    WHEN SL2.RecurseLevel IS NULL
    THEN SL1.RecurseLevel
    ELSE CASE
    WHEN SL3.RecurseLevel IS NULL
    THEN SL2.RecurseLevel
    ELSE CASE
    WHEN SL4.RecurseLevel IS NULL
    THEN SL3.RecurseLevel
    ELSE CASE
    WHEN SL5.RecurseLevel IS NULL
    THEN SL4.RecurseLevel
    ELSE CASE
    WHEN SL6.RecurseLevel IS NULL
    THEN SL5.RecurseLevel
    ELSE CASE
    WHEN SL7.RecurseLevel IS NULL
    THEN SL6.RecurseLevel
    ELSE CASE
    WHEN SL8.RecurseLevel IS NULL
    THEN SL7.RecurseLevel
    ELSE CASE
    WHEN SL9.RecurseLevel IS NULL
    THEN SL8.RecurseLevel
    ELSE CASE
    WHEN SL10.RecurseLevel IS NULL
    THEN SL9.RecurseLevel
    ELSE SL10.RecurseLevel
    END
    END
    END
    END
    END
    END
    END
    END
    END AS RecurseLevel
    FROM
    cte_SuiteLevel_0 AS SL0
    LEFT OUTER JOIN cte_SuiteLevel_1 AS SL1 ON SL1.ParentSuiteId = SL0.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_2 AS SL2 ON SL2.ParentSuiteId = SL1.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_3 AS SL3 ON SL3.ParentSuiteId = SL2.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_4 AS SL4 ON SL4.ParentSuiteId = SL3.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_5 AS SL5 ON SL5.ParentSuiteId = SL4.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_6 AS SL6 ON SL6.ParentSuiteId = SL5.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_7 AS SL7 ON SL7.ParentSuiteId = SL6.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_8 AS SL8 ON SL8.ParentSuiteId = SL7.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_9 AS SL9 ON SL9.ParentSuiteId = SL8.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_10 AS SL10 ON SL10.ParentSuiteId = SL9.SuiteId
    SELECT
    SS.[ProjectId],
    SS.[PlanId],
    SS.[ParentSuiteId],
    SS.[SuiteId],
    SS.[ProjectName],
    SS.[PlanName],
    SS.[Path],
    SS.[RecurseLevel]
    FROM
    SELECT DISTINCT
    S.[ProjectId],
    S.[PlanId],
    S.[ParentSuiteId],
    S.[SuiteId],
    S.[ProjectName],
    S.[PlanName],
    S.[Path],
    S.[RecurseLevel]
    FROM
    cte_Suites AS S
    WHERE
    S.[RecurseLevel] IS NOT NULL
    AND S.[Path] IN $($SuitePaths)
    ) AS SS
    ORDER BY
    SS.[Path]
    $Command.CommandText = $SQLStatement
    $Command.Connection = $Connection
    $Command.CommandTimeout = 240
    $DataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $DataAdapter.SelectCommand = $Command
    $DataSet = New-Object System.Data.DataSet
    $DataAdapter.Fill($DataSet) | Out-Null
    Write-Output "$SQLStatement" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> $DataSet.Tables[0]
    return $DataSet
    3. Execute every suite in the record set via TCM
    $DataSet = ( Retrieve-SuitePaths -LogFile:$LogFile -Connection:$Connection -Path:$Paths)
    # --DEBUG ONLY--> $DataSet.Tables[0].Rows.Count
    # --DEBUG ONLY--> $DataSet.Tables[0]
    # Determine whether or not any test suites were retrieved from TFS....
    if ( $DataSet.Tables[0].Rows.Count -gt 0 )
    $ListTestRunID = $null
    $SumFailed = 0
    $SumInconclusive = 0
    foreach ($Row in $DataSet.Tables[0].Rows)
    # Set project, plan & suite variables....
    [Int16]$ProjectID = $Row.Item('ProjectId')
    [Int16]$PlanID = $Row.Item('PlanId')
    [Int16]$ParentSuiteID = $Row.Item('ParentSuiteId')
    [Int16]$SuiteID = $Row.Item('SuiteId')
    $ProjectName = $Row.Item('ProjectName')
    $PlanName = $Row.Item('PlanName')
    $Path = $Row.Item('Path')
    $RecurseLevel = $Row.Item('RecurseLevel')
    # Set local build path variable....
    switch -wildcard ($Path)
    "*WebCMS*\Administration\*"
    $CUITBuildPath = $CUITPathUNC + '\WebCMS\Administration'
    "*WebCMS*\Instructor\*"
    $CUITBuildPath = $CUITPathUNC + '\WebCMS\Instructor'
    "*WebCMS*\Student\*"
    $CUITBuildPath = $CUITPathUNC + '\WebCMS\Student'
    "*WebProduct*\Instructor\*"
    $CUITBuildPath = $CUITPathUNC + '\WebProduct\Instructor'
    "*WebProduct*\Student\*"
    $CUITBuildPath = $CUITPathUNC + '\WebProduct\Student'
    default
    $CUITBuildPath = $CUITPathUNC
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output 'Test Suite:' | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output " ID:" | Out-File -FilePath $LogFile -Append
    Write-Output " Project: $ProjectID" | Out-File -FilePath $LogFile -Append
    Write-Output " Plan: $PlanID" | Out-File -FilePath $LogFile -Append
    Write-Output " Parent Suite: $ParentSuiteID" | Out-File -FilePath $LogFile -Append
    Write-Output " Suite: $SuiteID" | Out-File -FilePath $LogFile -Append
    Write-Output " Config: $ConfigurationID" | Out-File -FilePath $LogFile -Append
    Write-Output " Name:" | Out-File -FilePath $LogFile -Append
    Write-Output " Project: $ProjectName" | Out-File -FilePath $LogFile -Append
    Write-Output " Plan: $PlanName" | Out-File -FilePath $LogFile -Append
    Write-Output " Config: $ConfigurationName" | Out-File -FilePath $LogFile -Append
    Write-Output " Path:" | Out-File -FilePath $LogFile -Append
    Write-Output " Suite: $Path" | Out-File -FilePath $LogFile -Append
    Write-Output " Build: $CUITBuildPath" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> Write-Output " Recursion: $RecurseLevel" | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    # Set TCM arguements....
    $ArguementPlanID = "/planid:$PlanID"
    $ArguementTitle = "/title:$Title - $Path (SuiteID: $SuiteID)"
    $ArguementSuiteID = "/suiteid:$SuiteID"
    $ArguementConfigurationID = "/configid:$ConfigurationID"
    $ArguementTFSCollection = "/collection:$TFSCollection"
    $ArguementTeamProject = "/teamproject:$TFSTeamProject"
    if(![string]::IsNullOrEmpty($CUITBuildPath))
    $ArguementBuildDirectory = "/builddir:$CUITBuildPath"
    $ArguementBuild = ""
    $ArguementBuildDefinition = ""
    else
    $ArguementBuildDirectory = ""
    $ArguementBuild = "/build:$TFSBuild"
    $ArguementBuildDefinition = "/builddefinition:$BuildDefinition"
    $ArguementTestEnvironment = "/testenvironment:$WebServer"
    $ArguementSettingsName = ""
    if(![string]::IsNullOrEmpty($SettingsName))
    $ArguementSettingsName = "/settingsname:$SettingsName"
    # Create test run....
    Write-Host "$TCMEXE 'run' '/create' $ArguementTitle $ArguementPlanID $ArguementSuiteID $ArguementConfigurationID $ArguementTFSCollection $ArguementTeamProject $ArguementBuild $ArguementBuildDefinition $ArguementBuildDirectory $ArguementTestEnvironment $ArguementSettingsName"
    Write-Output " $TCMEXE 'run' '/create' $ArguementTitle $ArguementPlanID $ArguementSuiteID $ArguementConfigurationID $ArguementTFSCollection $ArguementTeamProject $ArguementBuild $ArguementBuildDefinition $ArguementBuildDirectory $ArguementTestEnvironment $ArguementSettingsName" | Out-File -FilePath $LogFile -Append
    try
    $TestRunID = & $TCMEXE 'run' '/create' $ArguementTitle $ArguementPlanID $ArguementSuiteID $ArguementConfigurationID $ArguementTeamProject $ArguementTFSCollection $ArguementBuild $ArguementBuildDefinition $ArguementBuildDirectory $ArguementTestEnvironment $ArguementSettingsName
    catch
    $ExitMessage = $_Exception.Message
    # --DEBUG ONLY--> Write-Output "TestRunID: $TestRunID" | Out-File -FilePath $LogFile -Append
    if ($TestRunID -match '.+\:\s(?<TestRunID>\d+)\.')
    # The test run ID is identified as a property in the match collection so we can access it directly by using the group name from the regular expression (i.e. TestRunID).
    $TestRunID = $matches.TestRunID
    $ArguementID = "/id:$TestRunID"
    $TestRunResultsFile = $TempDirectory + "\TestRunResults$TestRunID.trx"
    $ArguementQueryText = "/querytext:SELECT * FROM TestRun WHERE TestRunID=$TestRunID"
    $ArguementResultsFile = "/resultsfile:""$TestRunResultsFile"""
    Write-Host " Waiting for test run to complete ..."
    Write-Host $TCMEXE 'run' '/list' $ArguementTeamProject $ArguementTFSCollection $ArguementQueryText
    Write-Output " $TCMEXE 'run' '/list' $ArguementTeamProject $ArguementTFSCollection $ArguementQueryText" | Out-File -FilePath $LogFile -Append
    $WaitingForTestRunCompletion = $true
    $WaitCount= 0
    while ($WaitingForTestRunCompletion)
    $WaitCount = $WaitCount + 1
    Write-Output " Waiting ($WaitCount)...." | Out-File -FilePath $LogFile -Append
    Start-Sleep -s $TestRunWaitDelay
    $TestRunStatus = & $TCMEXE 'run' '/list' $ArguementTeamProject $ArguementTFSCollection $ArguementQueryText
    $TestRunStatus
    if ($TestRunStatus.Count -lt 3 -or ($TestRunStatus.Count -gt 2 -and $TestRunStatus.GetValue(2) -match '.+(?<DateCompleted>\d+[/]\d+[/]\d+)'))
    $WaitingForTestRunCompletion = $false
    Write-Host "Evaluating test run $TestRunID results..."
    # Take small pause(s) since the results might not be published yet....
    Start-Sleep -s $TestRunWaitDelay
    # Export results....
    Write-Host $TCMEXE 'run' '/export' $ArguementID $ArguementTeamProject $ArguementTFSCollection $ArguementResultsFile
    Write-Output " $TCMEXE 'run' '/export' $ArguementID $ArguementTeamProject $ArguementTFSCollection $ArguementResultsFile" | Out-File -FilePath $LogFile -Append
    $WaitingForTestRunExport = $true
    $WaitCount= 0
    while ($WaitingForTestRunExport -and $WaitCount -lt 5)
    $WaitCount = $WaitCount + 1
    Write-Output " Waiting ($WaitCount)...." | Out-File -FilePath $LogFile -Append
    $ExportResult = & $TCMEXE 'run' '/export' $ArguementID $ArguementResultsFile $ArguementTFSCollection $ArguementTeamProject
    if ([System.IO.File]::Exists($TestRunResultsFile))
    $WaitingForTestRunExport = $false
    if ([System.IO.File]::Exists($TestRunResultsFile))
    # Load the XML document contents.
    [xml]$TestResultsXML = Get-Content "$TestRunResultsFile"
    # Extract the results of the test run.
    $TotalTests = $TestResultsXML.TestRun.ResultSummary.Counters.total
    $PassedTests = $TestResultsXML.TestRun.ResultSummary.Counters.passed
    $FailedTests = $TestResultsXML.TestRun.ResultSummary.Counters.failed
    $InconclusiveTests = $TestResultsXML.TestRun.ResultSummary.Counters.inconclusive
    # Output the results of the test run.
    Write-Host "========== Test: $TotalTests tests ran, $PassedTests succeeded, $FailedTests failed, $InconclusiveTests inconclusive =========="
    Write-Output "--------------------------------------------------------------------------------" | Out-File -FilePath $LogFile -Append
    Write-Output "Summary:" | Out-File -FilePath $LogFile -Append
    Write-Output "--------------------------------------------------------------------------------" | Out-File -FilePath $LogFile -Append
    Write-Output " Total: $TotalTests" | Out-File -FilePath $LogFile -Append
    Write-Output " Passed: $PassedTests" | Out-File -FilePath $LogFile -Append
    Write-Output " Failed: $FailedTests" | Out-File -FilePath $LogFile -Append
    Write-Output " Inconclusive: $InconclusiveTests" | Out-File -FilePath $LogFile -Append
    $SumFailed += $FailedTests
    $SumInconclusive += $InconclusiveTests
    # Remove the test run results file.
    [System.IO.File]::Delete($TestRunResultsFile) | Out-Null
    # Add "current" TestRunID to the list of TestRunID(s)....
    if ($ListTestRunID -ne $null)
    $ListTestRunID = $ListTestRunID + ', '
    $ListTestRunID = $ListTestRunID + $TestRunID
    # Next test suite....
    4. Extract record set of test runs  from TFS via SQL query:
    # FUNCTION: Retrieve-TestRuns
    # Parameters:
    # (1.) LogFile -- Name of log file (e.g., C:\Temp or C:\Temp\DEPLOY_DatabaseServer_WebCMS2_DF06_20131031.6.log)
    # (2.) Connection -- Database connection
    # (3.) ListTestRunID -- List of test run identifiers
    Function Retrieve-TestRuns
    param
    [Parameter(Mandatory=$True)][String]$LogFile,
    [Parameter(Mandatory=$True)]$Connection,
    [Parameter(Mandatory=$True)][String]$ListTestRunID
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "Retrieve test run(s): " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    $TestRuns = '(' + $ListTestRunID + ')'
    $Command = New-Object System.Data.SqlClient.SqlCommand
    $SQLStatement = "
    WITH
    cte_State
    AS
    SELECT 0 AS [StateID], 'Unspecified' AS [StateName]
    UNION ALL
    SELECT 1 AS [OutcomeId], 'To Be Determined (1)' AS [StateName]
    UNION ALL
    SELECT 2 AS [StateID], 'In Progress' AS [StateName]
    UNION ALL
    SELECT 3 AS [StateID], 'Completed' AS [StateName]
    UNION ALL
    SELECT 4 AS [StateID], 'Aborted' AS [StateName]
    UNION ALL
    SELECT 5 AS [OutcomeId], 'To Be Determined (5)' AS [StateName]
    UNION ALL
    SELECT 6 AS [StateID], 'Needs Investigation' AS [StateName]
    SELECT
    TR.[ProjectId] AS [Project Id],
    P.[ProjectName],
    TR.[TestPlanId] AS [Plan Id],
    TP.Name AS [TestPlanName],
    TR.[TestRunId] AS [Run Id],
    TR.[Title],
    S.[StateID] AS [State Id],
    S.[StateName] AS [State],
    TR.[StartDate] AS [Date Started],
    TR.[CompleteDate] AS [Date Completed],
    DATEDIFF(SECOND, TR.[StartDate], TR.[CompleteDate]) AS Duration,
    TR.[Type],
    TR.[IsAutomated],
    TR.[TotalTests] AS [Total],
    TR.[PassedTests] AS [Passed],
    TR.[IncompleteTests] AS [Incomplete],
    TR.[UnanalyzedTests] AS [Unanalyzed],
    TR.[NotApplicableTests] AS [Not Applicable]
    FROM
    [Tfs_DefaultCollection].[dbo].[tbl_TestRun] AS TR
    INNER JOIN [Tfs_DefaultCollection].[dbo].[tbl_Project] AS P ON TR.ProjectId = P.ProjectId
    INNER JOIN [Tfs_DefaultCollection].[dbo].[tbl_Plan] AS TP ON TR.TestPlanId = TP.PlanId
    INNER JOIN cte_State AS S ON TR.[State] = S.[StateID]
    WHERE
    TR.TestRunId IN $($TestRuns)
    ORDER BY
    TR.[StartDate]
    $Command.CommandText = $SQLStatement
    $Command.Connection = $Connection
    $Command.CommandTimeout = 30
    $DataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $DataAdapter.SelectCommand = $Command
    $DataSet = New-Object System.Data.DataSet
    $DataAdapter.Fill($DataSet) | Out-Null
    Write-Output "$SQLStatement" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> $DataSet.Tables[0]
    return $DataSet
    5. Extract record set of test results from TFS via SQL query:
    # FUNCTION: Retrieve-TestRunResults
    # Parameters:
    # (1.) LogFile -- Name of log file (e.g., C:\Temp or C:\Temp\DEPLOY_DatabaseServer_WebCMS2_DF06_20131031.6.log)
    # (2.) Connection -- Database connection
    # (3.) ListTestRunID -- List of test run identifiers
    Function Retrieve-TestRunResults
    param
    [Parameter(Mandatory=$True)][String]$LogFile,
    [Parameter(Mandatory=$True)]$Connection,
    [Parameter(Mandatory=$True)][String]$ListTestRunID
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "Retrieve test result(s): " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    $TestRuns = '(' + $ListTestRunID + ')'
    $Command = New-Object System.Data.SqlClient.SqlCommand
    $SQLStatement = "
    WITH
    cte_Outcome
    AS
    SELECT 0 AS [OutcomeId], 'To Be Determined (0)' AS [OutcomeName]
    UNION ALL
    SELECT 1 AS [OutcomeId], 'In Progress' AS [OutcomeName]
    UNION ALL
    SELECT 2 AS [OutcomeId], 'Passed' AS [OutcomeName]
    UNION ALL
    SELECT 3 AS [OutcomeId], 'Failed' AS [OutcomeName]
    UNION ALL
    SELECT 4 AS [OutcomeId], 'Inconclusive' AS [OutcomeName]
    UNION ALL
    SELECT 5 AS [OutcomeId], 'To Be Determined (5)' AS [OutcomeName]
    UNION ALL
    SELECT 6 AS [OutcomeId], 'Aborted' AS [OutcomeName]
    UNION ALL
    SELECT 7 AS [OutcomeId], 'Blocked' AS [OutcomeName]
    UNION ALL
    SELECT 8 AS [OutcomeId], 'Not Executed' AS [OutcomeName]
    UNION ALL
    SELECT 10 AS [OutcomeId], 'Error' AS [OutcomeName]
    UNION ALL
    SELECT 11 AS [OutcomeId], 'Not Applicable' AS [OutcomeName]
    UNION ALL
    SELECT 12 AS [OutcomeId], 'Paused' AS [OutcomeName]
    UNION ALL
    SELECT 13 AS [OutcomeId], 'To Be Determined (13)' AS [OutcomeName]
    UNION ALL
    SELECT 255 AS [OutcomeId], 'Never Run' AS [OutcomeName]
    cte_State
    AS
    SELECT 0 AS [StateID], 'None' AS [StateName]
    UNION ALL
    SELECT 1 AS [StateID], 'Ready' AS [StateName]
    UNION ALL
    SELECT 2 AS [StateID], 'Completed' AS [StateName]
    UNION ALL
    SELECT 3 AS [StateID], 'Not Ready' AS [StateName]
    UNION ALL
    SELECT 4 AS [StateID], 'In Progress' AS [StateName]
    UNION ALL
    SELECT 5 AS [StateID], 'To Be Determined' AS [StateName]
    SELECT DISTINCT
    TR.[TestRunId] AS [Run Id],
    TR.[TestCaseId] AS [Case Id],
    O.[OutcomeID] AS [Outcome Id],
    O.[OutcomeName] AS [Outcome],
    S.[StateID] AS [State Id],
    S.[StateName] AS [State],
    TR.[TestCaseTitle] AS [Title],
    TR.[AutomatedTestName] AS [Automation Method],
    TR.[DateStarted] AS [Date Started],
    TR.[DateCompleted] AS [Date Completed],
    DATEDIFF(SECOND, TR.[DateStarted], TR.[DateCompleted]) AS Duration,
    TR.[FailureType] AS [Failure Type],
    TR.[ErrorMessage] AS [Error]
    FROM
    [Tfs_DefaultCollection].[dbo].[tbl_TestResult] AS TR
    INNER JOIN cte_Outcome AS O ON TR.Outcome = O.OutcomeID
    INNER JOIN cte_State AS S ON TR.State = S.StateID
    WHERE
    TR.TestRunId IN $($TestRuns)
    ORDER BY
    TR.[TestRunId],
    O.[OutcomeName],
    TR.[TestCaseTitle]
    $Command.CommandText = $SQLStatement
    $Command.Connection = $Connection
    $Command.CommandTimeout = 30
    $DataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $DataAdapter.SelectCommand = $Command
    $DataSet = New-Object System.Data.DataSet
    $DataAdapter.Fill($DataSet) | Out-Null
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "SQL Statement: " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "$SQLStatement" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> $DataSet.Tables[0]
    return $DataSet
    6. Email results to distribution list  
        Currently, I'm simplifying the extraction of suite path ... replacing hardcoded depth with STUFF() & XML PATH
    Carl.

Maybe you are looking for

  • Pictures and music not showing

    Sorry for posting multiple times. I bought the curve recently with the media card alrdy installed. I connected the curve to laptop and transfered all the pics. and music. When i checked the media file on curve, nothing was there and more interesting

  • C++ tab delimited file to array

    Converting a large tcl project into c++ and i am struggling with the simplest tasks. For example, i used to create array of data from my file using the following method. .debug.t insert end "Reading Well Data\n" ; update set fileId [open data/$wellda

  • Webpages do not display correctly, but do when i uninstall certain add-ons

    i had the firefox add-ons of shaved beiber and adblocker plus. one day, websites such as blaghag, 100boatsin100days, halolz, and other websites using the design of blog posts or main text with extra links alongside, or websites such as equinox kayaks

  • Sales order incomplete check

    Hi I am using FM to create the sales order. I need to check the completion of the created sales order. Is there any function module to do this. I cant find any export parameter in the above FM which gives the same. Regards Anandan

  • Bapi for create po

    I want to run bapi to create  purchase order for that  I had checked the function module "BAPI_PO_CREATE" in that I had filled all the required fields  to run the function module although  it is showing two errors 1  E 06026 " Please enter material n