How to get another DataTable from original DataTable?
-
Here, it is source code
public DataTable SearchField(string strSearch, string strFieldName)
{
DataTable dt = new DataTable();foreach (DataRow dr in data.Rows) { string strT = dr\[strFieldName\].ToString(); if (stringSearchMP(strSearch, strT) != -1) { DataRow row = dr; dt.ImportRow(row); } } return dt; }
I don't know to cause why my function return null. Because,
DataGridView.DataSource = dt
can't show data. Anyone help me?:confused: Anyway, thanks so much!!! -
Here, it is source code
public DataTable SearchField(string strSearch, string strFieldName)
{
DataTable dt = new DataTable();foreach (DataRow dr in data.Rows) { string strT = dr\[strFieldName\].ToString(); if (stringSearchMP(strSearch, strT) != -1) { DataRow row = dr; dt.ImportRow(row); } } return dt; }
I don't know to cause why my function return null. Because,
DataGridView.DataSource = dt
can't show data. Anyone help me?:confused: Anyway, thanks so much!!! -
Here, it is source code
public DataTable SearchField(string strSearch, string strFieldName)
{
DataTable dt = new DataTable();foreach (DataRow dr in data.Rows) { string strT = dr\[strFieldName\].ToString(); if (stringSearchMP(strSearch, strT) != -1) { DataRow row = dr; dt.ImportRow(row); } } return dt; }
I don't know to cause why my function return null. Because,
DataGridView.DataSource = dt
can't show data. Anyone help me?:confused: Anyway, thanks so much!!!maybe you need ot clone the table structure from source datatable,like 'dt=data.Clone()',then import rows.
-
maybe you need ot clone the table structure from source datatable,like 'dt=data.Clone()',then import rows.
-
What actually do u want to do? can u explain in detail.
Thanks & Regards, Pramod "Everyone is a genius at least once a year"
-
Here, it is source code
public DataTable SearchField(string strSearch, string strFieldName)
{
DataTable dt = new DataTable();foreach (DataRow dr in data.Rows) { string strT = dr\[strFieldName\].ToString(); if (stringSearchMP(strSearch, strT) != -1) { DataRow row = dr; dt.ImportRow(row); } } return dt; }
I don't know to cause why my function return null. Because,
DataGridView.DataSource = dt
can't show data. Anyone help me?:confused: Anyway, thanks so much!!!