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

  • Home
  • SEARCH
  • 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 8840827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:33:22+00:00 2026-06-14T10:33:22+00:00

I search a way to create query by using a dataset as database simulator.

  • 0

I search a way to create query by using a dataset as database simulator.
The dataset contain each table with primary key column. It also have foreign keys.
simulate database vb.net

I search a way to create the “Where” part by giving a list of Key/Value.

The dataset will be empty, its only a way to create an exponential list of query.

Sample:
sample:

Table A
colA

And

Table B
colB
colD

linked by

Table C
colA
colB

and

Table D
colD

I give the list

[colA] 1
[colA] 2
[colA] 3
[colB] 5
[colB] 6
[colD] 8

I want a query of every item on Table A containing element specified in the list.

Select * 
from TableA
where colA in (1,2,3)
and colA in (
            select colA 
            from TableC
            where colB in (5,6)         
            and colB in (
                            select colB
                            from TableB
                            where colD in (8)
                        )
            )

So I’m searching an algo to create the query. like any query generator working.


I can want data from any of those tables.

this of a function

function GetSubQuery(table, list(of keyValue) as string

my sample ask for TableA. but I can want TableB or C or D. with the same id List.


Situation (simulation)

I want table A,B or D.

I can ask for table A, giving id from colD. 
I can ask for table A, giving id from colB.
I can ask for table A, giving id from colA.
I can ask for table A, giving id from colB and colD.
I can ask for table A, giving id from colB and colA.
I can ask for table A, giving id from colB and colD and colA.

I can ask for table B, giving id from colD.
... 

we have here 18 possibilities.

But I dont want a query for the max possibilities and use it for every possibilites.
I mean the query for “table A, giving id from colB and colD and colA.” should not be use if you only have id from colA.
Because it can have a lot of data in the other table and you will search inside without needed.

the algo need to know, if you dont need to go there, you dont.

  • 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-14T10:33:24+00:00Added an answer on June 14, 2026 at 10:33 am

    DataSets and DataTables do not support TSQL.
    TSQL pretty just talks to a database engine.

    You can define PK, PK FK relationships, and walk those relations.
    Navigating DataRelations
    You can cast to List and use LINQ to query.

    LINQ (Language-Integrated Query)

    Or you can just iterate the rows and do equality comparison.

    SQL CE is an embedded database that supports TSQL.

    Another option is XML and use LINQ to query the the XML.

    Personally I would do this with classes (not DataSets) and overrite gethashcode and equals.
    DataSets are heavy and slow and collection have come a long way in .NET.
    Use HashSets (or Dictionary of KeyedCollection) for the collections.
    Even have class TblATblD that represents the join and use HashSet.
    If your ID can be Int16 then you can pack the two Int16 into Int32 on TblATblD.
    I do this with Users Groups and then a UrsGrp.
    User can see certain Fields.
    Queries kind of like what you are talking about all in LINQ.

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

Sidebar

Related Questions

I create a query with some results reused. I search a way to put
What's the easiest way to search a div for a text string using jquery?
Is there a way to search in a database a custom string and replace
I'm using .getJSON to send a search query to my PHP server and am
I'm trying to create a small search for my site. I've tried using full-text
Using PostgreSQL 8.4 and with a table such as this: create table log (
I have an ASP.NET application which needs to search a VARCHAR(20) column using lists
I'm using dynamic LINQ to create a query from given columns the user selects
I am writing a simple search engine for my database using mysqli and prepared
SO I am trying to create a way to structure my database to be

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.