I was struggling hard to find out the column names to extract values from HP Quality Center database. Most of us know the user defined name that is available in the HP QC application. But in order to extract data or to write custom reports using vb script or any other information we need database field names. Some time there will be names like “Custom 1” or “User 1” are there in HP QC application and people specifically need that field in the report. I was going crazy for a while to find those names. After some research, I wrote the following piece of code which extracts all the user defined fields from HP QC database. Hope this helps some one in need..
TDAPIOLELib.Command cmd = (TDAPIOLELib.Command)td.Command;
cmd.CommandText = "SELECT SF_COLUMN_NAME, SF_USER_LABEL FROM SYSTEM_FIELD where SF_TABLE_NAME='BUG' order by SF_COLUMN_NAME";
TDAPIOLELib.Recordset rs = (TDAPIOLELib.Recordset)cmd.Execute();
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\qccolumnmapping.txt"))
file.WriteLine(rs["SF_COLUMN_NAME"] + "," + rs["SF_USER_LABEL"]);