Newbie questions adapting the Picture app for mobile

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
classicmydac
Posts: 38
Joined: Fri 23 Dec 2005 11:51

Newbie questions adapting the Picture app for mobile

Post by classicmydac » Tue 27 Dec 2005 12:32

I am coming from database programming in delphi so the learning curve is hurting my brain. I hope someone can point me in the right direction.

I have adapted the app to include a few more fields etc, and understand the connection settings etc.

The app works fine if I have a connection. What I need to do is fill up the datagrid with images, desc etc whilst not connected. I can then connect and update the tables with the new data.

I cannot work out how to 'open' the data grid without being connected.

Once the above is working I need to do the following:
Loop through the datagrid.
Check if the record exists (the field is Reg_Num) if so updated if not insert new record.

Any help appreciated


SteveW

Serious

Post by Serious » Thu 29 Dec 2005 09:46

In ADO.NET DataGrid component does not store data, it only displays it.
You have to use DataTable component (standalone or as a part of DataSet). To add new rows to it use DataTable.Rows.Add method.
For additional information please refer to corresponding documentation.

classicmydac
Posts: 38
Joined: Fri 23 Dec 2005 11:51

dataset

Post by classicmydac » Thu 29 Dec 2005 17:05

Visual studio 2005 C#.

I have the following code

DataTable table;

table = dataSet1.Tables["Park1"];

// Use the NewRow method to create a DataRow with

// the table's schema.

DataRow newRow = table.NewRow();

// Set values in the columns:

newRow["Column1"] = "NewCompanyID";

newRow["Column2"] = "NewCompanyName";

// Add the row to the rows collection.

table.Rows.Add(newRow);

// Save Changes

dataSet1.park1.DataSet.AcceptChanges();

I created the datasource in visual studio by

adding new item

adding dataset

created a table called Park1 with colums.

Inc (Key)

column1

column2

When I run on my device all goes as planned except I cannot edit the data in the grid and when I exit the app and re-run the table does not retain the data.

I am trying to fill the table with data so when the device has a connection to MYSql server I can transfer the data across then clear the data from the device.

Any help appreciated



SteveW

Serious

Post by Serious » Tue 03 Jan 2006 08:10

I cannot edit the data in the grid
DataGrid in .NET Compact Framework does not allow editing contents of its cells.

Code: Select all

// Save Changes
dataSet1.park1.DataSet.AcceptChanges();
To synchronize DataSet contents with database use MySqlDataAdapter.Update method.

Post Reply