Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8894195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:26:04+00:00 2026-06-14T23:26:04+00:00

In my data base i have made a table with columns ProductId int Unchecked

  • 0

In my data base i have made a table with columns

ProductId                int            Unchecked
[Sports Name]            nvarchar(50)   Checked
Category                 nvarchar(50)   Checked
Brand                    nvarchar(50)   Checked
Image                    text           Checked
MRP                      varchar(50)    Checked
[Our Price]              varchar(50)    Checked
[You Save]               varchar(50)    Checked
[Shipping Charges]       varchar(50)    Checked
[Expected Delivery]      varchar(50)    Checked

and on the front hand i have create many linkbuttons such as badminton, tennis , table tennis etc.. and a drop downlist to choose the equipment wanted such as racket and shuttle for badminton, bat and ball for the cricket and so on after that a dropdownlist to choose its brand.

Now I want them to display the products as choosen by customer on the click and selection event only in one page not by creating page for each category Some what like this
(the coding is not exact, it is just sample that what i want)

if(badminton.click==true)
{
  cmd.text= seclect * from products where [Sports Name == Badminton] And Category==setectedcategory and so on 
} 
else if(tennis.click==true
{
}
...........so on

or only in one statement just like

cmd.text= select * from products where [Sports Name]==LinkButton.click And all like this

Now please help me if u understand what i want.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:26:06+00:00Added an answer on June 14, 2026 at 11:26 pm

    There are some problems in your database, I have to point to:

    • Don’t use spaces in the columns’ names, such as [Our Price], [Expected Delivery]. You can, but it is recommended not to do this. Your identifiers should comply to default rules for regular identifiers.

    • For monetary or currency values, use MONEY, SMALLMONEY1 it has many benifits, or even DECIMAL in some cases. Not NVARCHAR the way you did in your Products table.

    • Use Date and Time data types instead of NVARCHAR like in [Expected Delivery]. And the most important one:

    • Your database isn’t normalized this way. You should create a separate tables for Cateogries, Sports and Brands.

    For instance:

    CREATE TABLE Equipments
    (
      EquipmentId   INT NOT NULL IDENTITY(1, 1) 
                    CONSTRAINT PK_EquipmentId PRIMARY KEY,
      EquipmentName NVARCHAR(50) NOT NULL
    ); 
    
    CREATE TABLE Sports
    (
       SportId   INT NOT NULL IDENTITY(1,1) 
                 CONSTRAINT PK_SportId PRIMARY KEY,
       SportName NVARCHAR(50)
    );
    
    CREATE TABLE SportsEquipments 
    (
       Id          INT NOT NULL IDENTITY(1, 1)<sup>2</sup> 
                   CONSTRAINT PK_SportsEquipmentId PRIMARY KEY,
       SportId     INT NOT NULL 
                   CONSTRAINT FK_SportId_Sports FOREIGN KEY 
                   REFERENCES Sports(SportId),
       EquipmentId INT NOT NULL 
                   CONSTRAINT FK_EquipmentId_Equipments FOREIGN KEY 
                   REFERENCES Equipments(EquipmentId)
    );
    
    CREATE TABLE Categories
    (
       CategoryId   INT NOT NULL IDENTITY(1, 1) 
                    CONSTRAINT PK_CategoryId PRIMARY KEY,
       CategoryName NVARCHAR(50)
    );
    
    CREATE TABLE Brands
    (
       BrandId   INT NOT NULL IDENTITY(1, 1) 
                 CONSTRAINT PK_BrandId PRIMARY KEY,
       BrandName NVARCHAR(50)
    );
    
    CREATE TABLE Products
    (
      ProductId        INT NOT NULL IDENTITY(1, 1) 
                       CONSTRAINT PK_ProductID PRIMARY KEY,
      SportId          INT NOT NULL 
                       CONSTRAINT FK_SportId_Products 
                       FOREIGN KEY REFERENCES Sports(SportId),
      CategoryId       INT NOT NULL 
                       CONSTRAINT FK_CategoryId_Categories 
                       FOREIGN KEY REFERENCES Categories(CategoryId),
      BrandId          INT NOT NULL 
                       CONSTRAINT FK_BrandId_Brands 
                       FOREIGN KEY REFERENCES Brands(BrandId),
      "Image"          TEXT,
      MRP              NVARCHAR(50),
      OurPrice         MONEY,
      YouSave          MONEY,
      ShippingCharges  MONEY,
      ExpectedDeliveryDate DATETIME
    );
    

    enter image description here

    How Can I insert into the tables this way?

    Later, when inserting into the Products table, in the insert from, you should display the list of sports, categories and brands as DropDownLists. But, in this drop down list, you only display the name of the entity. You only display the CategoryName in the Categories dropdown, BrandName in the Brands dropdown and so on. And you can do this using the following two properties of the drop down list:

    • DataValueField to the Id.
    • DataTextField to the Name.

    Something like:

    dropdown.DataSource = dataset;
    dropdown.DataValueField  = "CategoryId";
    dropdown.DataTextField = "CategoryName";
    dropdown.DataBind();
    //the same for other entities
    

    Then you should insert only the selected id from the drop down list, and your INSERT statement would look something like:

    INSERT INTO Products (SportId, CategoryId, BrandId, ... )
    VALUES
    (1, 2, 3, ...); 
    

    But How can I Select and Search?

    The same in the Search form, you should display these entities as drop down list then search for the products with the id selected by the drop down list:

    SELECT ProductId, Name, ...
    FROM Products
    Where CategoryId = @SelectedCategoryId
     AND SportId = @selectedSportId
    ...
    

    The same with your current problem, you can dynamically created link buttons from these entities, the categories list and sports list as well as other entities. This can be done using the GridView control, then create a data source and bind it to this grid view. With an <ItemTemplate> as <asp:LinkButton> and bind it to the column name selected by your query. If you googled for this, you will find a lot of threads explaining how you can do this. For example :

    • Dynamically add link buttons based on database result.

    Hope this is what are you looking for.


    • 1:In some cases, may be you shouldn’t use it.

    • 2:In the SportsEquipments, I used the Id as a primary key, this way you any equipment can be referenced by many sports. If you want to make the equipment unique for each sports make a composite key(SportId, EquipmentId) instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table in data base name train delay, with columns train number(int), DelayTime(int),
I have a table made in SQL Server 2005 which has the following columns:
I have a Table with these columns Id as integer Name as string Image
i have these columns in the table and made this table as the FACT
I have made a dump of my database in which one table is pretty
I have a MySQL database and with a php function i made a table
I have a file data.base which looks like: 1234 XXXX 4321 XXXX 9884 ZZZZ
I have created a data base that comes in an installer that runs as
I have a table with 3 columns StartDate, EndDate, ElapsedTimeInSec . I use an
I have made the following code to retrive data from SQLite database. public Cursor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.