Ejemplo n.º 1
0
        public static DataTable W3Cquery(string queryST, ref string retErr)
        {
            DataTable resultsDT = new DataTable("resultsDT");

            try
            {
                LogQuery oLogQuery = new LogQuery();
                MSUtil.COMIISW3CInputContextClassClass oInputFormat = new MSUtil.COMIISW3CInputContextClassClass();

                // Execute the query
                LogRecordSet oRecordSet = oLogQuery.Execute(queryST, oInputFormat);
                int          i          = 0;
                for (; i < oRecordSet.getColumnCount(); i++)
                {
                    string colnm;
                    colnm = oRecordSet.getColumnName(i);
                    resultsDT.Columns.Add(new DataColumn(colnm, typeof(string)));
                }

                for (; !oRecordSet.atEnd(); oRecordSet.moveNext())
                {
                    MSUtil.ILogRecord rowLP = null;
                    rowLP = oRecordSet.getRecord();

                    DataRow dr = resultsDT.NewRow();
                    for (int ct = 0; ct < i; ct++)
                    {
                        dr[ct] = rowLP.getValue(ct);
                    }
                    resultsDT.Rows.Add(dr);
                }

                // Close the recordset
                oRecordSet.close();
            }
            catch (Exception exc)
            {
                retErr = "Unexpected error: " + exc.Message;
            }

            return(resultsDT);
        }
Ejemplo n.º 2
0
        public static DataTable W3Cquery(string queryST, ref string retErr)
        {
            DataTable resultsDT = new DataTable("resultsDT");
            try
            {
                LogQuery oLogQuery = new LogQuery();
                MSUtil.COMIISW3CInputContextClassClass oInputFormat = new MSUtil.COMIISW3CInputContextClassClass();

                // Execute the query
                LogRecordSet oRecordSet = oLogQuery.Execute(queryST, oInputFormat);
                int i = 0;
                for (; i < oRecordSet.getColumnCount(); i++)
                {
                    string colnm;
                    colnm = oRecordSet.getColumnName(i);
                    resultsDT.Columns.Add(new DataColumn(colnm, typeof(string)));
                }

                for (; !oRecordSet.atEnd(); oRecordSet.moveNext())
                {
                    MSUtil.ILogRecord rowLP = null;
                    rowLP = oRecordSet.getRecord();

                    DataRow dr = resultsDT.NewRow();
                    for (int ct = 0; ct < i; ct++)
                    {
                        dr[ct] = rowLP.getValue(ct);
                    }
                    resultsDT.Rows.Add(dr);
                }

                // Close the recordset
                oRecordSet.close();
            }
            catch (Exception exc)
            {
                retErr = "Unexpected error: " + exc.Message;
            }

            return resultsDT;
        }