Combo box and select query
Combo box and select query
Combo box and select query
Combo box and select query
Combo box and select query
Combo box and select query Combo box and select query Combo box and select query Combo box and select query Combo box and select query Combo box and select query Combo box and select query
Combo box and select query Combo box and select query
Combo box and select query
Windows Forms Topics include: windows forms, controls, components and designers

Enjoy an ad free experience by logging in. Not a member yet? Register.
Go Back  Xtreme .NET Talk > > > Combo box and select query


Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2012, 01:43 PM
mulefeathers mulefeathers is offline
Newcomer
 
Join Date: Sep 2004
Posts: 1
mulefeathers is on a distinguished road
Default Combo box and select query



I have a basic windows form in VB. I am using the following code to connect to a SQL database. The database has two tables. The goal here is have a user make a selection in one combo box and populate the other with only the records that match the query. The first combobox is populated by table tblsymbols column process. The second is populated by tblparts and should fill the box with all part numbers where the process columns match.

Private Sub frmParts_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.TblPartsTableAdapter.Fill(Me.KanbanDataSet.tblParts)

Me.TblSymbolsTableAdapter.Fill(Me.KanbanDataSet.tblSymbols)
Dim sqlprocess As String = Nothing
sqlprocess = "SELECT * from tblSymbols"
cboprocess.DataSource = KanbanDataSet.Tables(1)
cboprocess.ValueMember = "Process"
cboprocess.SelectedValue = -1


End Sub

Private Sub ProcessComboBox_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboprocess.SelectedIndexChanged

Dim strprocess As String = cboprocess.Text
Dim strpart = "SELECT PartNumber FROM tblParts WHERE Process = strprocess"

End Sub

Any help would be great.
Reply With Quote
  #2  
Old 09-14-2016, 03:01 AM
Goggy Goggy is offline
Newcomer
 
Join Date: May 2006
Posts: 10
Goggy is on a distinguished road
Default Re: Combo box and select query

Quote:
Dim strpart = "SELECT PartNumber FROM tblParts WHERE Process = strprocess"
try replacing that with

Code:
Dim strpart = "SELECT PartNumber FROM tblParts WHERE Process = " & strprocess
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select query on datatable lidds Database / XML / Reporting 1 09-20-2008 02:48 AM
Passing Parameters into a select query C# rmokkenstorm Database / XML / Reporting 5 05-11-2006 09:01 AM
How do I code so that combo box will always selected 1st before Query azae Windows Forms 1 02-03-2005 07:08 AM
Select query on two databases parminder Database / XML / Reporting 1 09-24-2003 03:06 PM
I need help with this select query... wyrd Database / XML / Reporting 3 05-25-2003 02:46 PM

Advertisement:







Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Combo box and select query
Combo box and select query
Combo box and select query Combo box and select query
Combo box and select query
Combo box and select query
Combo box and select query Combo box and select query Combo box and select query Combo box and select query Combo box and select query Combo box and select query Combo box and select query
Combo box and select query
Combo box and select query
 
Combo box and select query
Combo box and select query