Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
Questionabout dynamic form and controls, database fields created by user throw c sharp .net windows application Pin
Muthuraj.M18-Feb-15 18:35
Muthuraj.M18-Feb-15 18:35 
AnswerRe: about dynamic form and controls, database fields created by user throw c sharp .net windows application Pin
OriginalGriff18-Feb-15 21:44
mveOriginalGriff18-Feb-15 21:44 
AnswerRe: about dynamic form and controls, database fields created by user throw c sharp .net windows application Pin
Richard MacCutchan18-Feb-15 22:04
mveRichard MacCutchan18-Feb-15 22:04 
QuestionWcf Service connection to SQL Database Pin
happyghoos18-Feb-15 12:21
happyghoos18-Feb-15 12:21 
Question[Solved] MySQL dataGridView search function problem Pin
Linus Agren18-Feb-15 9:47
Linus Agren18-Feb-15 9:47 
AnswerRe: MySQL dataGridView search function problem Pin
Ron Nicholson18-Feb-15 10:00
professionalRon Nicholson18-Feb-15 10:00 
GeneralRe: MySQL dataGridView search function problem Pin
Linus Agren19-Feb-15 4:56
Linus Agren19-Feb-15 4:56 
QuestionDataGridView et oracle Pin
youssefcss18-Feb-15 5:32
youssefcss18-Feb-15 5:32 
j'ai essayé de faire un dataGridView pour visualiser des données a partir d'une database Oracle

voici mon essai : le datagrid est vide Cry | :(( Cry | :(( Cry | :(( mon table contient 7 champs et il est rempli par 6 lignes

C#
private void LoadGrid()
        {
            selection sel = new selection();
            sel.ExecuteSql("select * from fournisseur");
            sel.getDr();
            if (sel.getDr().HasRows)
            {
                while (sel.getDr().Read())
                {
                    dataGridView1.Rows.Add(sel.getDr()[2].ToString(), sel.getDr()[4].ToString(), sel.getDr()[5].ToString(), sel.getDr()[6].ToString());
                }
            }
        }


et voici la classe de connexion

C#
sing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
namespace Gestion_Budgétaire
{
    public class Connexion
    {
        protected String cs="Data source=XE;User Id=system; Password=12345;";
        protected OracleConnection conn;
        protected OracleCommand cmd;
        public void ouvrir()
        {
            try
            {
                conn = new OracleConnection();
                conn.ConnectionString = cs;
                conn.Open();
            }     
            catch (Exception ex)
            {
                MessageBox.Show("Error Fatal!" + ex.Message);
            }
        }
        public void close()
        {
            try
            {
                conn.Close();
                MessageBox.Show("disconnected");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Echec!" + ex.Message);

            }
        }
    }
    public class selection 
        : Connexion
    {
        private OracleDataReader dr;
        public OracleDataReader getDr()
        {
            return dr;
        }
        public void ExecuteSql(String re)
        {
                ouvrir();
                try
                {
                    cmd = new OracleCommand();
                    cmd.Connection = conn;
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = re;
                    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                
         }   
      }
    public class mettre_a_jour 
        : Connexion
    {
        public void update(String reqSql)
        {
            ouvrir();
            try
            {
                cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = reqSql;
                cmd.ExecuteNonQuery();
                MessageBox.Show("DataBase Updated");
            }
            catch(Exception ex)
            {
                MessageBox.Show("error fatal" + ex.Message);
            }
        }
    }
}
SVP aidez moi Cry | :(( Cry | :(( Cry | :((
SuggestionRe: DataGridView et oracle Pin
Richard MacCutchan18-Feb-15 5:41
mveRichard MacCutchan18-Feb-15 5:41 
QuestionFast Image Stitching Pin
JBHowl18-Feb-15 5:03
JBHowl18-Feb-15 5:03 
AnswerRe: Fast Image Stitching Pin
Ravi Bhavnani18-Feb-15 5:12
professionalRavi Bhavnani18-Feb-15 5:12 
GeneralRe: Fast Image Stitching Pin
JBHowl18-Feb-15 5:21
JBHowl18-Feb-15 5:21 
GeneralRe: Fast Image Stitching Pin
Eddy Vluggen18-Feb-15 5:45
professionalEddy Vluggen18-Feb-15 5:45 
GeneralRe: Fast Image Stitching Pin
JBHowl18-Feb-15 9:00
JBHowl18-Feb-15 9:00 
GeneralRe: Fast Image Stitching Pin
Eddy Vluggen18-Feb-15 9:26
professionalEddy Vluggen18-Feb-15 9:26 
AnswerRe: Fast Image Stitching Pin
Gerry Schmitz18-Feb-15 16:17
mveGerry Schmitz18-Feb-15 16:17 
GeneralRe: Fast Image Stitching Pin
JBHowl6-May-15 3:21
JBHowl6-May-15 3:21 
GeneralRe: Fast Image Stitching Pin
Gerry Schmitz6-May-15 9:51
mveGerry Schmitz6-May-15 9:51 
AnswerRe: Fast Image Stitching Pin
Pete O'Hanlon23-Feb-15 2:36
mvePete O'Hanlon23-Feb-15 2:36 
Questiongenetic algorithm using C# Pin
Member 1143886118-Feb-15 1:26
Member 1143886118-Feb-15 1:26 
AnswerRe: genetic algorithm using C# Pin
CHill6018-Feb-15 1:40
mveCHill6018-Feb-15 1:40 
QuestionRe: genetic algorithm using C# Pin
ZurdoDev18-Feb-15 1:59
professionalZurdoDev18-Feb-15 1:59 
AnswerRe: genetic algorithm using C# Pin
CHill6018-Feb-15 2:12
mveCHill6018-Feb-15 2:12 
Questionhelp on WebBrowser Controller to select a value on a drop down list Pin
Member 1144865317-Feb-15 18:47
Member 1144865317-Feb-15 18:47 
AnswerRe: help on WebBrowser Controller to select a value on a drop down list Pin
Richard MacCutchan17-Feb-15 22:45
mveRichard MacCutchan17-Feb-15 22:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.