p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 30th, 2005, 01:59 AM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2005
Location: tundla, u.p., India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default filling of datagrid

i m trying to fill datadrid (dg1) from the data set (ds) of the table (emp) ,my code is like that


private void bt1_Click(object sender, System.EventArgs e)
 {

        string select = "SELECT * FROM emp";
        SqlConnection cnn=new SqlConnection("Data source=localhost;Integrated Security=SSPI;" + "Initial Catalog=Rahul");

        SqlCommand cmd = new SqlCommand(select , cnn);
        SqlDataAdapter da = new SqlDataAdapter ( select ,cnn);
        DataSet ds = new DataSet();
        da.Fill(ds , "emp");
        MessageBox.Show("rahul");


        dg1.SetDataBinding(ds,"emp");

        }

BUT COMPILER GIVES "SYSTEM ERROR"

please solve my problem.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old March 30th, 2005, 10:52 AM
Friend of Wrox
Points: 4,754, Level: 29
Points: 4,754, Level: 29 Points: 4,754, Level: 29 Points: 4,754, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Try

dg1.DataSource = ds
dg1.DataMember = "emp"
dg1.DataBind()




Brian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 29th, 2005, 07:24 AM
Friend of Wrox
Points: 367, Level: 6
Points: 367, Level: 6 Points: 367, Level: 6 Points: 367, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , India.
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think u r doing it on windows so SetDataBinding() is ok
Try
SetDataBinding(ds.Tables[0],ds.Tables[0].ToString());

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
filling a datagrid with a crosstab? debbiecoates Pro VB Databases 0 April 15th, 2008 12:51 PM
filling the screen darkhalf CSS Cascading Style Sheets 0 September 26th, 2006 03:29 PM
Filling out DataSet from Datagrid MAKO C# 2 May 13th, 2006 09:15 AM
filling Dataset with datagrid variables frankv25 ASP.NET 1.0 and 1.1 Professional 1 August 30th, 2004 02:05 PM
filling of dataset abhimca_1 ADO.NET 2 August 5th, 2003 04:05 PM



All times are GMT -4. The time now is 08:25 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc