locked
C# Dataset Blank Rows RRS feed

  • Question

  • Hi All,

      I would like to know is it possible to delete the blank rows from a Dataset without using loop ?

    Friday, November 19, 2010 11:18 AM

Answers

  • You should also consider stopping blank rows at the source where they are entered, rather than circumventing them on back-end.  Blank rows don't make sense.


    Javaman
    Friday, November 19, 2010 3:09 PM

All replies

  • Hi All,

     I would like to know is it possible to delete the empty rows from a dataset without looping ?

     

    Note : There is no primary coloumn

    Friday, November 19, 2010 11:20 AM
  • unless you iterate thru the rows you would never get to know whether the data in the row is empty or nor. On a second thought, what kind of data pulling mechanism that you are using to read the data from DB, then i might give you some solution
    Every thing is perfect as long as you share
    • Proposed as answer by Chakravarthy Friday, November 19, 2010 11:35 AM
    Friday, November 19, 2010 11:34 AM
  • Hi Chakravarthy,

         I am exporting the datas from an excel sheet and filling it in dataset.

    connString =

    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strNewPath + ";Extended Properties=\"Excel 12.0;HDR=NO;IMEX=2\"";

    query =

    "SELECT * FROM [Sheet1$]";

     

    This s the tink im using.

    ** If i try with query = "SELECT DISTINCT * FROM [Sheet1$]";

    i am not gettin the blank rows, but my orderr is getting collapsed like

    Row no: 5 cuming in Row 1 of the dataset

    Row 3 cuming in Row 5 of the dataset

       

     

    Friday, November 19, 2010 11:39 AM
  • You could use LINQ probably, but that would do the looping internally. Eventually something somewhere will have to loop through the dataset.
    Friday, November 19, 2010 12:13 PM
  • Can you try using the MicrosoftJetDB instead of OLEDB provider. Now i see a problem with records jumbling their position.
    Every thing is perfect as long as you share
    Friday, November 19, 2010 12:18 PM
  • Friday, November 19, 2010 1:06 PM
  • You should also consider stopping blank rows at the source where they are entered, rather than circumventing them on back-end.  Blank rows don't make sense.


    Javaman
    Friday, November 19, 2010 3:09 PM
  • Hi , I am using excel 2007 format, so i dnt have an alternative option rather than ACE driver.
    Monday, November 22, 2010 3:18 AM