What's wrong with these 3 lines of code? (C#, oleDb, beginner's level)

Posted on 2005-04-07
Last Modified: 2010-05-18
I am trying to display all shirt descriptions where there is the word "red" in the desc.
Code compiled fine. There is something missing in this sequence that crashes app when I run:

         oleDbDataAdapter1.SelectCommand.CommandText = "SELECT Item_No, Shirt_Desc FROM SHIRTS WHERE Shirt_Desc LIKE %red%";

First I filled out the Select Command then I clear the dsShirt dataset. Finally, I assume that when the adapter's Fill is executed, the select command is automatically carried out. I must be wrong because it doesn't work as intended.

Question by:rj94070
    LVL 7

    Accepted Solution

    shouldnt %red% be in single quotes - '%red%'?

    Author Comment

    Thanks sweatbeast!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
    A short article about a problem I had getting the GPS LocationListener working.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now