locked
Searching in database based on certain cetria RRS feed

  • Question

  • User263687624 posted

    Scenario Description –

    I have two asp pages and two corresponding table in database.

    For Ex.

    1. Applicantdetail.aspx  ; table name in sql database – Applicantdetail
    2. Projectdetail.aspx ; Table name in sql database – projectdetail

     

    Design of applicant details.aspx ---

                   Applicant name -       Text box                                                                          Applicant Id -   Textbox     

                   Mobile No. -               Text Box                                                                          City         -         Text Box  

                   Booking Date -           Calendar                                           

      Design of Projectsetails.aspx ---

                  Flat No. -          Textbox                   Area -                     Text Box

                  Rate -                Text Box                  Basic Price -          Text Box (in this result should be area * rate)

                 Other charges -    Text Box

    1.       So when user is giving input from front end it should save data in database.

    2.       Now I have another report.aspx page, through which I want to generate a report consisting of all column from both table based on specific criteria.

    Design of report.aspx for implementing search criteria –

                  Applicant name -      Text Box                          Flat No. -                     Textbox

                  Applicant id -          Text Box                            Booking Date -           Calendar

                   Mobile No. -           Text Box

         Search

     So after giving input in any of search criteria field, it should generate a report including all columns from both table.

    Let me know if any other clarification is required.

    Thanks & regards

    Prashant

    Email id- prashantpatel321@gmail.com

    Thursday, November 2, 2017 11:27 AM

All replies

  • User1120430333 posted

    The retuned results is either case of some kind of a query of the database can be using the DTO pattern in a List<DTO>/collection of DTO(s).

    https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp

    Thursday, November 2, 2017 7:32 PM
  • User-707554951 posted

    Hi prashantpatel321,

    From your description, it seems that you have wrong idea when you design your database table.

    I think you want something about how to join two tables in sql. You want to combine rows from two or more tables

    however, there is no related column in your datables. 

    So, you need to provided related column between tables based on your needs.

    You could learn how to join tables by referring to the following link:

    https://www.w3schools.com/sql/sql_join.asp

    After this, if you still have problem, You could post the code you have written.

    Best regards

    Cathy

    Friday, November 3, 2017 2:59 AM
  • User263687624 posted
    Hi Cathy,
    Thanks For correcting me ..
     Lets consider ..
    1. Applicant ID in Applicantdetail table is a primary key and foreign key for Project detail table.
    2.Flat No. in projectdetail table is primary key and foreign key for Applicantdetail table.
    Let me know if any other clarification or corrective action is required.
    Thanks & regards
    Prashant
    Friday, November 3, 2017 3:34 AM
  • User-707554951 posted

    Hi prashantpatel321,

    Let me know if any other clarification or corrective action is required.

    From your description, it seems that Applicantdetail table  and Project detail table have relationship already.

    Now, You are in the process of programming or data query and display a problem?

    Best regards

    Cathy

    Thursday, November 9, 2017 9:52 AM