PC Review


Reply
Thread Tools Rate Thread

Binding a DataAdapter to a DataGrid

 
 
javabunch
Guest
Posts: n/a
 
      24th Feb 2005
Hello,
I am new to .Net and ADO.NET. I used Visual Studo .Net to create a
Oracle DataAdapter. Now I want to bind to a DataGrid to display the
result of the SQL Statment. I tried the following source code but it
does not work :-(

Here the code:

DataTable myTable = new DataTable();
DataSet myDataset = new DataSet();
oracleDataAdapter1.Fill(myTable);
myDataset.Tables.Add(myTable);
dataGrid1.DataSource = ;
dataGrid1.Visible = true;

Could someone tell me what I am doing wrong? I am happy for any help
:-)

Greetings

Javabunch


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      24th Feb 2005
JavaBunch

We love those simple ones

> DataTable myTable = new DataTable();
> oracleDataAdapter1.Fill(myTable);

assuming you have made the connection and the selectstring in the
construction of the dataadapter or any other way.
> dataGrid1.DataSource = myTable;


The most simple one, you can change DataTable for Dataset and than as
datasource in this case
myDataset.Tables[0];

I hope this helps?

Cor


 
Reply With Quote
 
javabunch
Guest
Posts: n/a
 
      25th Feb 2005
Hello,
Thanks for help. Now I am not getting a error message but it does not
display the result of the sql statment that it should. I use the
following code. Do I have to connect the DataAdapter in another way?
I use the update methode in the moment.

Sourcecode:
DataTable myTable = new DataTable();
oracleDataAdapter1.Update(myDataset);
dataGrid1.DataSource = myDataset;
dataGrid1.Visible = true;

I tried to used the oracleDataAdapter.Fill Methode but I got the same
error message :-( So I used update() instead of fill()

By the way I am german so please excuse my english.

Thanks for your help

Greetings

Javabunch


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      25th Feb 2005
JavaBunch

Is this a windowform or a webform?

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Speed using a dataadapter and datagrid =?Utf-8?B?TWF0dGhldw==?= Microsoft Dot NET Compact Framework 6 16th Oct 2006 08:01 AM
Help with DataAdapter Fill and Binding pwh777@gmail.com Microsoft VB .NET 2 21st Sep 2005 03:44 PM
threading, what different between DataGrid Binding to Binding TextBox mttc Microsoft Dot NET Framework Forms 3 19th Nov 2004 08:33 AM
DataGrid, DataAdapter, SP Parameters? James Microsoft ASP .NET 1 7th Oct 2004 12:21 PM
Bug when Binding a DataTable to a ComboBox using new MS Oracle DataAdapter Dextor Microsoft C# .NET 0 8th Sep 2003 04:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:52 AM.