Exemple #1
0
        // Executes query using passed params, places results in
        // passed IDMListView control
        // Calls must be preceded by a BindToLib
        public void ExecQuery(ref DataGridView IDMLView, string sWhereClause, string sFolderName, int iMaxRows, DocEntry.FormMain FormPrinc)
        {
            if (oQueryLib != null)
            {
                // Build the string necessary to bind to the database connection
                //sConnect = "provider=FnDBProvider;data source=" + oQueryLib.Name + ";Prompt=4;SystemType=" + ((int)(oQueryLib.SystemType)) + ";";
                // Build the query string

                //sQuery = "SELECT * FROM FnDocument ";
                sQuery = "SELECT * FROM Document ";
                SearchSQL   sqlObject   = new SearchSQL();
                SearchScope searchScope = new SearchScope(oQueryLib);
                if (sWhereClause.Length > 0)
                {
                    sQuery = sQuery + "WHERE " + sWhereClause;
                }

                // Set up the properties on the record set
                if (oRS != null)
                {
                    oRS = null;
                }
                //Set oMiBD = New ADODB.Connection
                //oMiBD.ConnectionString = sConnect
                //oMiBD.Open
                //oRS = new ADODB.Recordset();
                //FSQ20070521: UPGRADE_WARNING:Couldn't resolve default property of object oRS.ActiveConnection. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                //oRS.let_ActiveConnection(sConnect);
                //oRS.Properties["SupportsObjSet"].Value = true;
                if (iMaxRows > 0)
                {
                    //oRS.MaxRecords = iMaxRows;
                    sQuery = sQuery + " OPTIONS ( BATCHSIZE " + iMaxRows + " )";
                }
                //oRS.Properties["SearchFolderName"].Value = sFolderName;
                // All set up - pull the trigger
                //oRS.LockType = ADODB.LockTypeEnum.adLockOptimistic;
                //oRS.Open sQuery, oMiBD, adOpenKeyset, , adCmdText
                //oRS.Open sQuery, oMiBD, adOpenKeyset

                //oRS.Open(sQuery, Type.Missing, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockUnspecified, -1);
                sqlObject.SetQueryString(sQuery);
                //sqlObject.SetQueryString(mySQLString);
                oRS = searchScope.FetchRows(sqlObject, null, null, true);
                ShowResults(IDMLView, FormPrinc);
            }
            else
            {
                MessageBox.Show("Must set library!", Application.ProductName);
            }
        }
Exemple #2
0
 public IDocumentSet queryDocs(string sSql, int maxRecords, int pageSize)
 {
     logMsg("mkQuery(" + sSql + "), maxRecords=" + maxRecords + ", batchSize=" + pageSize + "...");
     SearchScope search = new SearchScope(objStore);
     SearchSQL searchSql = new SearchSQL();
     if (maxRecords > 0)
         searchSql.SetMaxRecords(maxRecords);
     // This must be done separately in order to call SetMaxRecords() etc
     searchSql.SetQueryString(sSql); 
     IDocumentSet documents =
         (IDocumentSet)search.FetchObjects(searchSql, pageSize, null, true);
     return documents;
 }
        // Executes query using passed params, places results in
        // passed IDMListView control
        // Calls must be preceded by a BindToLib
        public void ExecQuery(ref DataGridView IDMLView, string sWhereClause, string sFolderName, int iMaxRows) //AxIDMListView.AxIDMListView
        {
            if (objObjectStore != null)
            {
                // Build the string necessary to bind to the database connection
                //sConnect = "provider=FnDBProvider;data source=" + oQueryLib.Name + ";Prompt=4;SystemType=" + ((int)oQueryLib.SystemType) + ";";
                // Build the query string

                String mySQLString = "SELECT * FROM ExpedientesDC  ";
                //String mySQLString = "SELECT * FROM Document  ";
                SearchSQL sqlObject = new SearchSQL();


                // The SearchSQL instance (sqlObject) can then be specified in the
                // SearchScope parameter list to execute the search. Uses fetchRows to test the SQL
                // statement.
                SearchScope searchScope = new SearchScope(objObjectStore);

                if (sWhereClause.Length > 0)
                {
                    sQuery = "";
                    sQuery = sQuery + "WHERE VersionStatus=1 " + sWhereClause;
                    //sQuery = sQuery + "WHERE VersionStatus=1 ";
                }

                // Set up the properties on the record set
                //if (oRS != null)
                //{
                oRS = null;
                //}
                //Set oMiBD = New ADODB.Connection
                //oMiBD.ConnectionString = sConnect
                //oMiBD.Open
                //oRS = new ADODB.Recordset();

                //oRS.let_ActiveConnection(sConnect);
                //oRS.Properties["SupportsObjSet"].Value = true;
                if (iMaxRows > 0)
                {
                    //searchScope.
                    //oRS.MaxRecords = iMaxRows;
                    sQuery = sQuery + " OPTIONS ( BATCHSIZE " + iMaxRows + " )";
                }
                //oRS.Properties["SearchFolderName"].Value = sFolderName;
                // All set up - pull the trigger
                //oRS.LockType = ADODB.LockTypeEnum.adLockOptimistic;
                //oRS.Open sQuery, oMiBD, adOpenKeyset, , adCmdText
                //oRS.Open sQuery, oMiBD, adOpenKeyset
                //oRS.Open(sQuery, Type.Missing, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockUnspecified, -1);

                try
                {
                    //MessageBox.Show("Query: " + mySQLString + sQuery);
                    sqlObject.SetQueryString(mySQLString + sQuery);
                    //sqlObject.SetQueryString(mySQLString);
                    oRS = searchScope.FetchRows(sqlObject, null, null, true);


                    ShowResults(ref IDMLView);
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Must set library!", Application.ProductName);
            }
        }