473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Joining combobox value and 2 tables?

111 100+
Hii all,

How to join two tables and a combobox value??

i have 2 combo boxes and 2 tables

i have aquery:

1)
Dim myselectquery As String = "SELECT pr_project_id_pk FROM tbl_projects WHERE tbl_projects.pr_project_location= ?SName"
cmSQL.Parameters.Add("?SName", objListItem.ToString)

and another query:
2)

Dim myselectquerya As String = "SELECT sta_category_id_fk FROM tbl_staff_assignments WHERE sta_project_id_fk=tbl_projects.pr_project_id_pk"


If sta_category_id_fk = 1 Then

MessageBox.Show("Already Available")

Else

Insert record
End If



now my doubt is: i need to join these two queries using joins....???? can u plz help me?

thnx in advance
hepsi..
Jul 11 '07 #1
3 1436
Vidhura
99
Hii all,

How to join two tables and a combobox value??

i have 2 combo boxes and 2 tables

i have aquery:

1)
Dim myselectquery As String = "SELECT pr_project_id_pk FROM tbl_projects WHERE tbl_projects.pr_project_location= ?SName"
cmSQL.Parameters.Add("?SName", objListItem.ToString)

and another query:
2)

Dim myselectquerya As String = "SELECT sta_category_id_fk FROM tbl_staff_assignments WHERE sta_project_id_fk=tbl_projects.pr_project_id_pk"


If sta_category_id_fk = 1 Then

MessageBox.Show("Already Available")

Else

Insert record
End If



now my doubt is: i need to join these two queries using joins....???? can u plz help me?

thnx in advance
hepsi..
I can't get ur requirment..please explain what should be the result
and give ur table details
Jul 11 '07 #2
rhepsi
111 100+
I can't get ur requirment..please explain what should be the result
and give ur table details


thnx for ur reply..

i have a form for staff insert

there are two combo boxes and a insert button_click
1. project name
2. categories name

in project name: i have list of projects namely:
1. abohar
2. ambedkar nagar

n so on...

in categories name: i hav list of categories
1.manager
2.HM
3.teacher
4.cook n so on....


now i have tables

1.tbl_projects,
2.tbl_staffs,
3.tbl_staff_assignments,
4.tbl_staff_categories

where tbl_projects:->> pr_project_location, pr_project_id_pk
tbl_staff_assignments:->>> sta_project_id_fk, sta_category_id_fk
tbl_staff_categories..>> sc_category_id_pk

for manager: sc_category_id_pk=1

Condition is: only 1 manager shd be inserted for 1 project...

Now when i select project name and category name,
if already manager is available in that project, then when i click on insert it shd pop up a error message tht manager is available..
or else it shd insert ....

that is my requirement..
i hope u understand

someone help me using joins....
hw to retrieve a combobox value...thru joins???
plz help me...


thnx
hepsi...
Jul 11 '07 #3
kenobewan
4,871 Expert 4TB
Here is an article that may help:
SQL JOIN
Jul 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: James | last post by:
Can anyone please shed some light on the following... I have a framework that uses dynamically created tables, named using an incremental "attribute set ID", as follows: attrdata_1 attrdata_2...
6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
0
by: Phillip | last post by:
I have a combobox. Currently with two values. The box is bound to a dataset. Once the form is loaded and I select the second value, the first\original value stays in the combobox. If I drop it down...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
1
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
7
by: samoore33 | last post by:
I am trying to dynamically add items to a listbox or combobox. The items add to either, but when I look through those items, there is nothing there. If I choose an item, it shows up. Not sure...
6
by: =?Utf-8?B?U2NvdHQgTGFt?= | last post by:
Hi, Is there any way to access the values (not display names)of a combobox ? For example: combo1.DataSource = dataset1.tables(0) combo1.DisplayMember = "Name" combo1.ValueMember = "ID"
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.