I want to select 1st 5 character and assign in stringarray, i tried the following code, but it showing me error. I want to select first 5 character of each row and assign to str. Suggest me some idea plz.
public string[] str;
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
str = dr[0].GetString(4).tostring();
}
just make use of SubString function that will do that task for you
full code