Hi,
I have a doubt.If i insert a value like this
'11,12|13,14|15,16'
it should save in the database table as follows
id value1 value2
1 11 12
2 13 14
3 15 16
how to achieve this please help me
Thanks in advance
Loading
siva sakthiPosted Aug 25, 2009, 5:22 AM
string strTable = "1,2|3,4|5,6";
DataTable dt = new DataTable();
dt.Columns.Add("id");
dt.Columns.Add("Value1");
dt.Columns.Add("Value2");
int i = 1;
foreach (string item in strTable.Split('|'))
{
string[] rowValues=item.Split(',');
dt.Rows.Add(i,rowValues[0], rowValues[1]);
i++;
}