jyoti

jyoti

  • NA
  • 2
  • 0

Displaying Data in DataGrid

Jul 14 2005 3:09 PM

Hi All,

I am not able to display the data in the datagrid,i am using button columns.

Can anyone help me with this?

if(radiocontrol==1)

{

string connectionInfo = ConfigurationSettings.AppSettings["ConnectionInfo"];

using(SqlConnection connection = new SqlConnection(connectionInfo))

{

connection.Open();

//string query="select e.EmpID,e.EmpName,e.EmpSkill,e.EmpExpert,ec.EmpCurCompany from Employee_Details e,Employee_Current_Details ec where e.EmpID=ec.EmpID and e.EmpSkill like' %@Empsi%'";

DataSet ds=new DataSet();

SqlDataAdapter adapter=new SqlDataAdapter();

SqlCommand cmd=new SqlCommand("disDataGrid",connection);

cmd.CommandType=CommandType.StoredProcedure;

cmd.Parameters.Add("@Empsi",SqlDbType.VarChar,60);

cmd.Parameters["@Empsi"].Value=txtDetails.Text;

txtSample.Text=txtDetails.Text;

adapter.SelectCommand=cmd;

//SqlParameter p=new SqlParameter();

//p=adapter.SelectCommand.Parameters.Add("@Empsi",SqlDbType.VarChar,60);

//adapter.SelectCommand.Parameters["@Empsi"].Value=txtDetails.Text;

adapter.Fill(ds);

DataGrid1.DataSource=ds.DefaultViewManager;

DataGrid1.DataBind();

//txtSample.Text=(string)ds.Tables["Emp"].Rows[0]["EmpID"];

}

Thanks

jyoti


Answers (2)