?
Solved

Binding results of query to repeater control

Posted on 2005-05-09
1
Medium Priority
?
121 Views
Last Modified: 2010-04-23
0
Comment
Question by:dprasad
1 Comment
 
LVL 14

Accepted Solution

by:
amyhxu earned 2000 total points
ID: 13965286
The problem is with your query strings :
"Select * From maintable where color=" & color.SelectedItem.Text
"Select * From maintable where category=" & category.SelectedItem.Text

In SQL you use "Select * From maintable where color = 'Red'" for string comparison.

So modify your query strings to:
"Select * From maintable where color = '" & color.SelectedItem.Text.Trim & "'"
"Select * From maintable where category = '" & category.SelectedItem.Text.Trim & "'"

Or use parameters in the query:
"Select * From maintable where color = @color"
"Select * From maintable where category = @category"
and you need the code to add parameters to sqlcommand.
 
By the way, if you use integers to represent color and category, your queries become:
"Select * From maintable where color=" & color.SelectedItem.Value
"Select * From maintable where category=" & category.SelectedItem.Value

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question