Fill Datasource with DataTable().GetData() ???

Fill Datasource with DataTable().GetData() ???

Postby ulf.sturegren@langley.eu » Fri 18 Dec 2009 11:02

Hi,

I'm Trying out dotConnect for the first time and is trying to create my first WPF app - and got lost immediately :-\

To fill my Grid I Normally (without dotConnect) would write something like;

gridHotels.DataSource = new
MyTableAdapter.HotelsTableAdapter().GetData();

But when using dotConnect I do not get any GetData() from the dsHotelsTableAdapters.HOTELSTableAdapter that I get from running the dotConnect DataSet Wizard ?

Anybody that have a solution to this ?

Best regards.
Uffe
ulf.sturegren@langley.eu
 
Posts: 2
Joined: Thu 17 Dec 2009 14:52

Postby StanislavK » Fri 18 Dec 2009 16:18

There are many ways of binding data to the grid using dotConnect for Oracle. Having a typed DataSet MyDataSet generated, you can set the DataSource property of the grid to some table from MyDataSet instance myDataSet1 at design-time. All you will need to do at run-time is to call the myDataSet1.Fill() method. Actually, it is a simpler way than using TableAdapters.

If Table Adapters are necessary for your task, you can generate them using Microsoft TableAdapter Configuration Wizard in DataSet Designer. At the moment, there is no support for the TableAdapter class generation while using Devart DataSet Wizard.

We plan to implement it, but cannot provide any timeframe.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby ulf.sturegren@langley.eu » Tue 22 Dec 2009 08:32

ok, I have done it like this;


dsHotels ds = new dsHotels();
gridHotels.DataSource = ds.Tables["HOTELS"];
ds.Fill();

Now I get "Connection has not been initiated" .. I guess I have to Connect ..

I find this in your samples.

using Devart.Data.Oracle;
...
OracleConnection oracleConnection1 = new OracleConnection();
oracleConnection1.Server = "OraServer";
oracleConnection1.UserId = "scott";
oracleConnection1.Password = "tiger";

Do I really have to give servers and login credentials again?
I thought that the "DataSet Wizard" created a Connection that could be used?
ulf.sturegren@langley.eu
 
Posts: 2
Joined: Thu 17 Dec 2009 14:52

Postby StanislavK » Tue 22 Dec 2009 14:11

Please try unchecking the "Use components" checkbox in DataSet Wizard. When this checkbox is checked, the typed DataSet has no initial connection and expects some OracleConnection object on the form. When "Use components" is false, the connection is encapsulated inside DataSet.

Otherwise, you can run DataSet Wizard from the form where the gridHotels grid is placed. Please check the "Add this DataSet to designer" checkbox when the wizard finishes. In this case the wizard will place onto the form OracleConnection needed to fill the dsHotels dataset.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle