Hello,
I try to insert data into the .mdb file . I use DataSet and DataAdapter object and OleDB library. I print the data from a file without any problem using DataGrid class.
In the Form1_Load i have line of code:
this
.tabela1TableAdapter.Fill(this
.zadaniaDataSet.Tabela1);
Then I add a button, after clicking on I want to save data into my database. For example for columns 'Tytul' and 'Opis' to my database called 'Tabela1' :
private void button1_Click(object sender, EventArgs e)
{
ZadaniaDataSet.Tabela1Row newTabela1Row;
newTabela1Row = ZadaniaDataSet.Tabela1.NewTabela1Row();
newTabela1Row.Tytul = "Cos";
newTabela1Row.Opis = "cos cos cos";
// Add the row to the Region table
this.zadaniaDataSet.Tabela1.Rows.Add(newTabela1Row);
// Save the new row to the database
this.tabela1TableAdapter.Update(this.zadaniaDataSet.Tabela1);
}
I have followed this specyfication :
http://msdn.microsoft.com/en-us/library/ms233812(VS.80 ).aspx
During the compilation debuger shows following mistake:
for : newTabela1Row = ZadaniaDataSet.Tabela1.NewTabela1Row();
Error1An object reference is required for the non-static field, method, or property 'WindowsFormsApplication5.ZadaniaDataSet.Tabela1.get'C:\Users\ir3\Documents\Visual Studio 2008\Projects\WindowsFormsApplication5\WindowsFormsApplication5\Form1.cs3629WindowsFormsApplication5
I will be gratefull for any help. What's wrong with my code?