Question

Problem 1: When you enters that he wants to enter n numbers of different records. C# creates that much number of rows and enters systematically.

For example:

Tbl1

    +----+----------+-----------+----------+
    | ID | NAME     | ADDRESS   | SALARY   |
    +----+----------+-----------+----------+
    | C1 | Ramesh   | Ahmedabad |  2000.00 |
    | C2 | Khilan   | Delhi     |  1500.00 |
    | C3 | kaushik  | Kota      |  2000.00 |
    | C4 | Chaitali | Mumbai    |  6500.00 |
    | C5 | Hardik   | Bhopal    |  8500.00 |
    | C6 | Komal    | MP        |  4500.00 |
    | C7 | Muffy    | Indore    | 10000.00 |
    +----+----------+-----------+----------+

When program ask enter numbers of data you want to ask. If you enters three then it creates dynamic textbox which enters all the records.

Data Table should be like this.....

  Tbl1
    +----+----------+-----------+----------+
    | ID | NAME     | ADDRESS   | SALARY   |
    +----+----------+-----------+----------+
    | C1 | Ramesh   | Ahmedabad |  2000.00 |
    | C2 | Khilan   | Delhi     |  1500.00 |
    | C3 | kaushik  | Kota      |  2000.00 |
    | C4 | Chaitali | Mumbai    |  6500.00 |
    | C5 | Hardik   | Bhopal    |  8500.00 |
    | C6 | Komal    | MP        |  4500.00 |
    | C7 | Muffy    | Indore    | 10000.00 |
    | C8 | Hari     | Goa       |  8550.00 |
    | C9 | Aum      | Panjab    |  4500.00 |
    +----+----------+-----------+----------+

So overall for this problem I am asking is either C# creates dynamic text box in one line (For insert one row. textbox should be in online line. For Second in second line).

Or it loads the GridView table with previously entered data as well two rows to enter new records.

Problem 2: How to sort table in ascending order?

For example if I enter new record C10 Ram Chennai 9000.00 By default it comes under

 Tbl1
    +----+----------+-----------+----------+
    | ID | NAME     | ADDRESS   | SALARY   |
    +----+----------+-----------+----------+
    | C1 | Ramesh   | Ahmedabad |  2000.00 |
    | C10| Ram      | Chennai   |  9000.00 |
    | C2 | Khilan   | Delhi     |  1500.00 |
    | C3 | kaushik  | Kota      |  2000.00 |
    | C4 | Chaitali | Mumbai    |  6500.00 |
    | C5 | Hardik   | Bhopal    |  8500.00 |
    | C6 | Komal    | MP        |  4500.00 |
    | C7 | Muffy    | Indore    | 10000.00 |
    | C8 | Hari     | Goa       |  8550.00 |
    | C9 | Aum      | Panjab    |  4500.00 |
    +----+----------+-----------+----------+

When sorting it should come under....

Tbl1
    +----+----------+-----------+----------+
    | ID | NAME     | ADDRESS   | SALARY   |
    +----+----------+-----------+----------+
    | C1 | Ramesh   | Ahmedabad |  2000.00 |
    | C2 | Khilan   | Delhi     |  1500.00 |
    | C3 | kaushik  | Kota      |  2000.00 |
    | C4 | Chaitali | Mumbai    |  6500.00 |
    | C5 | Hardik   | Bhopal    |  8500.00 |
    | C6 | Komal    | MP        |  4500.00 |
    | C7 | Muffy    | Indore    | 10000.00 |
    | C8 | Hari     | Goa       |  8550.00 |
    | C9 | Aum      | Panjab    |  4500.00 |
    | C10| Ram      | Chennai   |  9000.00 |
    +----+----------+-----------+----------+

Row C10 should come under C9. How to sort table?

Was it helpful?

Solution

you can use this : Select * From Tbl1 order by len(id), id. you can read this answer which is very useful

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top