|
|
 |
| .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.
|
 |

March 30th, 2005, 01:59 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Location: tundla, u.p., India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

March 30th, 2005, 10:52 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Try
dg1.DataSource = ds
dg1.DataMember = "emp"
dg1.DataBind()
Brian
|

June 29th, 2005, 07:24 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2004
Location: , , India.
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think u r doing it on windows so SetDataBinding() is ok
Try
SetDataBinding(ds.Tables[0],ds.Tables[0].ToString());
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |