简体   繁体   中英

binding to datagridview in C#?

I have a problem with my datagridview that is binding to an access table(access 2007), I can retrieve data from the database, but when I wan to store data I cant, even no code is generated, I just want that the user fill some rows in the datagridview and store them in the table of the database, please help me I am new to C# please help me

  private void Form1_Load(object sender, EventArgs e)
    {
        // TODO: This line of code loads data into the 'policiasDataSet.LineaAccion' table. You can move, or remove it, as needed.
        this.lineaAccionTableAdapter.Fill(this.policiasDataSet.LineaAccion);
        // TODO: This line of code loads data into the 'policiasDataSet.Seccion' table. You can move, or remove it, as needed.
        this.seccionTableAdapter.Fill(this.policiasDataSet.Seccion);
        // TODO: This line of code loads data into the 'policiasDataSet.Actividad' table. You can move, or remove it, as needed.
        this.actividadTableAdapter.Fill(this.policiasDataSet.Actividad);
        // TODO: This line of code loads data into the 'policiasDataSet.Proyecto' table. You can move, or remove it, as needed.
        this.proyectoTableAdapter.Fill(this.policiasDataSet.Proyecto);
        // TODO: This line of code loads data into the 'policiasDataSet.ProyectoObjetivo' table. You can move, or remove it, as needed.
        this.proyectoObjetivoTableAdapter.Fill(this.policiasDataSet.ProyectoObjetivo);
        // TODO: This line of code loads data into the 'policiasDataSet.Objetivo' table. You can move, or remove it, as needed.
        this.objetivoTableAdapter.Fill(this.policiasDataSet.Objetivo);
        // TODO: This line of code loads data into the 'policiasDataSet.Municipio' table. You can move, or remove it, as needed.
        this.municipioTableAdapter.Fill(this.policiasDataSet.Municipio);
        // TODO: This line of code loads data into the 'policiasDataSet.Logro' table. You can move, or remove it, as needed.
        this.logroTableAdapter.Fill(this.policiasDataSet.Logro);

    }

    private void fillByToolStripButton_Click(object sender, EventArgs e)
    {
        try
        {
            this.proyectoTableAdapter.FillBy(this.policiasDataSet.Proyecto);
        }
        catch (System.Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.Message);
        }

    }

It's hard to know what happen if you dont post your source code here. I guess you might want to have a look at OleDBDataAdapter.Update(Datatable table) manual.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM