예제 #1
0
        public void preencheGrid(DataGridView grd, String sQuery)
        {
            conexao c = new conexao();

            //PREENCHE O GRID..
            DataSet ds     = null;
            string  select = sQuery;
            var     conn   = new OdbcConnection();

            conn.ConnectionString = c.getConexaoString();
            conn.Open();
            OdbcDataAdapter dataAdapter = new OdbcDataAdapter(select, conn);

            OdbcCommandBuilder commandBuilder = new OdbcCommandBuilder(dataAdapter);

            ds = new DataSet();

            dataAdapter.Fill(ds);

            grd.ReadOnly = true;

            grd.DataSource = ds.Tables[0];

            grd.CurrentCell = null;

            // grd.Columns[0].Visible = false;

            grd.ClearSelection();

            conn.Close();
        }
예제 #2
0
        public int RetornaIdVendaAtual()
        {
            conexao c  = new conexao();
            int     id = Convert.ToInt32(c.RetornaQuery("select isnull(max(id),0) as id from vendas", "id"));

            id++;
            return(id);
        }