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 6545677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:36:53+00:00 2026-05-25T11:36:53+00:00

Possible Duplicate: Problem in datareader retrieving data I have Memberships and Bookings tables in

  • 0

Possible Duplicate:
Problem in datareader retrieving data

I have Memberships and Bookings tables in database containing an attribute cust_id which is primary key in Memberships and reference key in Bookings. When i am executing data reader I want it to read cust_id values from membership table but it is reading it from the bookings table…..

One major purpose for which i have joined the tables is that there are other validations (not concerned with this problem..just mentioned the reason of joining table) which need attributes from the bookings tables like for example i have to check whether new booking overlaps with some already made booking or not….

I have 3 unique cust_id values in the Memberships table i.e. csc-01,csc-02,csc-03 and 6 Bookings in Bookings table all are for csc-01 and csc-02 and there is no booking for customer with cust_id csc-03…When I’m selecting from Memberships i.e. Memberships.cust_id then, as i have used message box to check the results, in MessageBox.Show(str1 & “,” & str3 & String.Equals(str1, str3)) str3 never shows a value csc-03 but it is present in MEmberships table…i want bookchk to iterate through all the values in Memberships.cust_id so that every time it is checked whether a customer has membership or not….I hope you have understood now

My query is:

str2 = "select Memberships.cust_id from Memberships, Bookings where   Memberships.cust_id  = Bookings.cust_id"
Dim cmd2 As New SqlCommand(str2, con)
con.Open()

Dim bookchk As SqlDataReader = cmd2.ExecuteReader  
While bookchk.Read()
Dim str1 As String = MskdTxtCustId.Text
Dim str3 As String = bookchk("cust_id")
MessageBox.Show(str1 & "," & str3 & String.Equals(str1, str3))

End While
bookchk.Close()
con.Close()
  • 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-05-25T11:36:54+00:00Added an answer on May 25, 2026 at 11:36 am
    select Memberships.cust_id from Memberships, Bookings where   
    Memberships.cust_id  = Bookings.cust_id
    union
    Memberships.cust_id from Memberships where 
    not exists (select Bookings.cust_id from Bookings where
    Memberships.cust_id  = Bookings.cust_id)
    

    if you add more columns in the first select, add constants 0 or blank in the second, the number of rows must be equal

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

Sidebar

Related Questions

Possible Duplicate: SQL Server Database query help Hi, I have a problem that I
Possible Duplicate: I have a problem with IFrame . Now i am using iframe.attribute(src)=..Pages/page.aspx....In
Possible Duplicate: Java - Regex problem I have list of URLs of types: http://www.example.com/pk/etc
Possible Duplicate: What's wrong with Delphi's “with” I am have a problem debugging code
Possible Duplicate: Problem with Macros Hi all I have defined this macro: #define SQ(a)
Possible Duplicate: Paypal Checkout Express empty cart problem i have an issue with paypal
Possible Duplicate: iPad iframe scrollbar problem I have an iframe inside a page and
Possible Duplicate: .Net Changes the element IDs I have the following problem (I'll explain
Possible Duplicate: Java string comparison? I have encounter the following problem, I have an
Possible Duplicate: Sql server version problem when database restore I would like to restore

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.