-
Re: Help with SQL syntax
strLastName = "me"
strSQL = "SELECT * FROM members WHERE lastname LIKE " & "'*" & strLastName &
"*'"
Regards,
Roy
"W.Pierce" <piercewe@co.forsyth.nc.us> wrote in message
news:3c0b93cc$2@147.208.176.211...
>
> Can anyone please tell me the proper syntax of an SQL statement
> when I need it to perform the following condition?
>
> I have a textbox called ....txt32
> the field name is called..... lastname
> The table is called.......members
>
> What I want to do, is to be able to type into the text box something
> like...... me* .....and have a search performed on the field called
> lastname and get it to return everything that contains the (me), such
> as Mecham, mechanic, me a moron, merry christmas, me program don't work,
>
> name, stopme, and so forth......
>
> I suspect the sql line would be something like...
>
> SELECT * FROM members WHERE lastname LIKE............and then I get
> lost......I have tried several combinations, but can't figure out
> how to get the contents of a text box recognized in an sql
> statement, especially if I want to do a wildcard search using * .....
>
> Could someone give me the correct syntax including correct punctuation
> using the above parameters.....
>
> thanks a bunch.
> william
-
Help with SQL syntax
Can anyone please tell me the proper syntax of an SQL statement
when I need it to perform the following condition?
I have a textbox called ....txt32
the field name is called..... lastname
The table is called.......members
What I want to do, is to be able to type into the text box something
like...... me* .....and have a search performed on the field called
lastname and get it to return everything that contains the (me), such
as Mecham, mechanic, me a moron, merry christmas, me program don't work,
name, stopme, and so forth......
I suspect the sql line would be something like...
SELECT * FROM members WHERE lastname LIKE............and then I get
lost......I have tried several combinations, but can't figure out
how to get the contents of a text box recognized in an sql
statement, especially if I want to do a wildcard search using * .....
Could someone give me the correct syntax including correct punctuation
using the above parameters.....
thanks a bunch.
william
-
Re: Help with SQL syntax
"Roy" <iroy55@hotmail.com> wrote:
>strLastName = "me"
>strSQL = "SELECT * FROM members WHERE lastname LIKE " & "'*" & strLastName
&
>"*'"
>
>Regards,
>Roy
>
>"W.Pierce" <piercewe@co.forsyth.nc.us> wrote in message
>news:3c0b93cc$2@147.208.176.211...
>>
>> Can anyone please tell me the proper syntax of an SQL statement
>> when I need it to perform the following condition?
>>
>> I have a textbox called ....txt32
>> the field name is called..... lastname
>> The table is called.......members
>>
>> What I want to do, is to be able to type into the text box something
>> like...... me* .....and have a search performed on the field called
>> lastname and get it to return everything that contains the (me), such
>> as Mecham, mechanic, me a moron, merry christmas, me program don't work,
>>
>> name, stopme, and so forth......
>>
>> I suspect the sql line would be something like...
>>
>> SELECT * FROM members WHERE lastname LIKE............and then I get
>> lost......I have tried several combinations, but can't figure out
>> how to get the contents of a text box recognized in an sql
>> statement, especially if I want to do a wildcard search using * .....
>>
>> Could someone give me the correct syntax including correct punctuation
>> using the above parameters.....
>>
>> thanks a bunch.
>> william
>
Hello my name is Miguel i'm from Portugal and i think i've your problem
First the sql statment is wrong
the statment that you need to write is something like this
select * from your table where bla='your value'
well if you have an textbox
you write like this
format to string is like this
"select * from your table where bla='" + textbox + "'"
if you want to send me the code i can fix it .
best regards
Miguel Cabaço
-
Re: Help with SQL syntax
"W.Pierce" <piercewe@co.forsyth.nc.us> wrote:
>
>Can anyone please tell me the proper syntax of an SQL statement
>when I need it to perform the following condition?
>
>I have a textbox called ....txt32
>the field name is called..... lastname
>The table is called.......members
>
>What I want to do, is to be able to type into the text box something
>like...... me* .....and have a search performed on the field called
>lastname and get it to return everything that contains the (me), such
>as Mecham, mechanic, me a moron, merry christmas, me program don't work,
>
>name, stopme, and so forth......
>
>I suspect the sql line would be something like...
>
>SELECT * FROM members WHERE lastname LIKE............and then I get
>lost......I have tried several combinations, but can't figure out
>how to get the contents of a text box recognized in an sql
>statement, especially if I want to do a wildcard search using * .....
>
>Could someone give me the correct syntax including correct punctuation
>using the above parameters.....
>
>thanks a bunch.
>william
In your code, for example in the Click event of that commandbutton that makes
the grid appear, put the following:
yourgrid.recordsource = "SELECT * FROM members WHERE lastname LIKE '" & txt32.text
& "%'"
if that doesn't work, then put an * instead of the %.
The above statements should not give a syntax error!!!
hth
huibert
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks