Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2005, 12:33 PM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select statement in VB6

hi got a slight problem here. this is a bit hard to write so work with me i have 3 combo boxes 2 of them "a and b" have select statements returning values from a sql table the third "c" needs to return values from the sql table based on the combo box b.

so when b is the same as the start of a concat code in the table return the code in line with the con cat code.

(this is what i think it should look like " select CC_CODE from CST_COSTCENTRE where CC_CONCAT_CODES "begins with" '" & CSTCODE & "'")(CSTCODE is the variable that uses what is selected in the combo box b.

i need to know how to do the "begins with" bit please help

thank you very much
have fun matthew allee

 
Old March 21st, 2005, 12:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

exact syntax depends on which database you are using and how you are calling it (ADO?), but in general you can do "begins with" by using LIKE along with whatever wildcard your db supports (generally %), example
... where CC_CONCAT_CODES LIKE '" & CSTCODE & "%'"

hth
Phil
 
Old March 22nd, 2005, 08:20 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi sorry thank you for your post i sorted it in the end i dropped into query analyser and plugged in all i could and wham exactly what you put nearly the code looked like this in the end "like '" & combo3.text & "%'" for those who need to know thank you very much for replying






Similar Threads
Thread Thread Starter Forum Replies Last Post
select Statement gregalb SQL Server 2000 3 January 15th, 2008 12:00 AM
select statement help... RinoDM SQL Server 2000 13 January 10th, 2008 08:34 PM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
Select Statement jmss66 VB How-To 3 March 13th, 2006 03:55 PM
select statement collie MySQL 0 January 14th, 2004 04:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.