Esempio n. 1
0
        private void GetDatabaseTables_Access()
        {
            OleDbConnection conn = null;

            try
            {
                conn = AccessHelper.Connection();
                conn.Open();
                DataTable schemaTable = conn.GetOleDbSchemaTable(
                    OleDbSchemaGuid.Tables,
                    new object[] { null, null, null, "TABLE" });

                rgrvTables.DataSource = schemaTable;

                ddlTables.DataBind(schemaTable, "TABLE_NAME", "TABLE_NAME", "Select a table");
            }
            catch (OleDbException ex)
            {
                Trace.Write(ex.Message);
                Response.Write(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Esempio n. 2
0
        private void ExecuteCommand(string cmdText)
        {
            try
            {
                OleDbCommand cmd = new OleDbCommand(cmdText, AccessHelper.Connection());

                cmd.Connection.Open();

                cmd.ExecuteNonQuery();

                cmd.Connection.Close();

                uscUyari1.UyariGoster("Command succesfull", "Success", false);
            }
            catch (Exception ex)
            {
                uscUyari1.UyariGoster("Can not execute command<br/>" + ex.Message, "Error", false);
            }
        }
Esempio n. 3
0
        protected void GetColumnNames_Access(string tableName)
        {
            if (tableName.xBosMu())
            {
                return;
            }

            OleDbConnection conn = null;

            try
            {
                conn = AccessHelper.Connection();
                conn.Open();
                string[] restrictions1            = new string[] { null, null, tableName, null };
                System.Data.DataTable schemaTable = conn.GetSchema("Columns", restrictions1).xSort("ORDINAL_POSITION");

                rgrvColumns.DataSource = schemaTable;
            }
            catch
            {
            }
        }