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
Posted Jul 21, 2005, 12:38 PM
KrishnajinaPosted Jul 21, 2005, 5:17 AM
The following worked for me well Try this
cnxnstring = "user id=sa; password=; initial catalog=SFM; Data Source=SERVER;";string
SqlConnection cnxn1=
new SqlConnection(cnxnstring);cnxn1.Open();
DataTable dstable =
new DataTable("data"); string selectstring = "Select ItemID, ItemTypeID,UOM from MF01_Item";SqlDataAdapter SDA=
new SqlDataAdapter(selectstring, cnxn1) ;SDA.Fill(dstable);
DataSet dsWork =
new DataSet();dsWork.Tables.Add(dstable);
dataGrid1.SetDataBinding(dsWork,"data");