Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

VB.net SQL Statement Problems

Using SQLCE in Visual Studio.net (VB) 2005, we have the following SQL statement which works as intended.

"SELECT ItemID, Title, DomesticShippingService1, DomesticShippingCost1, ShippingAdditionalCost1 FROM EUKSLData"

We use that statement again (with a WHERE) later in our code to give more specific results in a datagrid.

"SELECT ItemID, Title, DomesticShippingService1, DomesticShippingCost1, ShippingAdditionalCost1 FROM EUKSLData WHERE (LType = 'Daily') AND (BPrice > '0') OR (LType = 'Weekly') OR (LType = 'Monthly')"

Again, this works as intended as does the folloiwng statement which is used to allow the user to refine their selection via a text box.

"SELECT ItemID, Title, DomesticShippingService1, DomesticShippingCost1, ShippingAdditionalCost1 FROM EUKSLData WHERE Title LIKE '%" & TextBox1.Text & "%'"

We would like to combine the second and third statements so that the LType and BPrice are also checked but can't seem to get it working. We need to keep the textbox to allow the users some input.

Any help would be appreciated. Thank you.
       









       

0
comsult
Asked:
comsult
1 Solution
 
UnifiedISCommented:
SELECT ItemID, Title, DomesticShippingService1, DomesticShippingCost1, ShippingAdditionalCost1 FROM EUKSLData WHERE( (LType = 'Daily') AND (BPrice > '0') OR (LType = 'Weekly') OR (LType = 'Monthly'))
AND
Title LIKE '%" & TextBox1.Text & "%'"
0
 
comsultAuthor Commented:
Perfect, thank you so much for the quick response.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now