Filling a datagrid with a dataset

Dec 13 2007 12:51 PM

Hi Everybody

I am very new to .net technology, i am trying to fill the datagrid with the dataset my code is as follows

string strConnectionString;

strConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

SqlConnection glbConn = new SqlConnection(strConnectionString);

glbConn.Open();

SqlDataAdapter MyAdaptor = new SqlDataAdapter();

DataSet myDataSet = new DataSet();

SqlCommand MyCommand = new SqlCommand();

MyCommand.CommandText = "GetPartyList";

MyCommand.Connection = glbConn;

MyCommand.CommandType = CommandType.StoredProcedure;

MyCommand.CommandTimeout = 300;

MyCommand.ExecuteNonQuery();

MyAdaptor.SelectCommand = MyCommand;

MyAdaptor.Fill(myDataSet);

dataGridView1.DataSource = myDataSet.DefaultViewManager;

--------------------------------------------------------------------------------------------------------------------------------------------

but at the end there is noting shown on my datagridview, plz suggest me whatz the mistake and tell me how do i fill the datagridview with the dataset. can anybody tell me what and all other things can be done with the datagridview and if you can suggest me a good turorial for learning c# i would be better.

Regards

Rajeev


Answers (1)