I'm hooking a DataSet up to a SQL CE 3.5 database and chasing down an exception (nullref). I think the issue may be caused by an empty DataSet but I'm struggling to understand the way in which the structure of a DataTable works.
If I populate a DataSet against a table where only the structure exists, no records have been added, what is the standard behavior? Is a DataTable of matching structure instantiated or is the DataSet left empty? (assuming this Database contains just the one table I'm connecting to in this case).
EDIT: Cheap example
Database "Contacts" with just 1 table "MyContacts". It has four fields, ContactID, Name, Phone, Email (int, nvarchar x3)
DataSet data = new DataSet()
SqlCeConnection connection = new SqlCeConnection();
SqlCeDataAdapter adapter = new SqlCeDataAdapter("SELECT * FROM MyContacts ", connection);
SqlCeCommandBuilder builder = new SqlCeCommandBuilder(adapter);
adapter.Fill(data, MyContacts);
return data;
What happends if the table exists (its structure is present) but there are no records?