By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

CONTAINSTABLE Statement - Help please!

P: n/a
Hello All:

I have been struggling to find out what could possibly be wrong with this
piece of code. From my understanding of the CONTAINSTABLE Function and using
parameters with a query, this should work. Obviously, I'm missing something!
I have confirmed that the variable strField does contain the proper value to
be used in the CONTAINSTABLE function. For whatever reason, it does not like
the syntax of it. Please take a look.... any suggestions appreciated!

- Brian

' Take the selected value of the drop down box and put it in strField
strField=DropDown.SelectedValue

' Return the value of strField to confirm what it contains
Button1.Attributes.Add("onclick","return confirm('" & strField & "');")

' Define SQL Connection parameters
conTorontoHardware = New SqlConnection( "server='*****';
trusted_connection=true; database=WorkstationsServers" )

' The SQL statement *PROBLEM* It's says: incorrect syntax near @Dropdown
strSearch = "SELECT RANK, * FROM WorkstationsServers," & _
"CONTAINSTABLE( WorkstationsServers, @Dropdown, @searchphrase )
searchTable " & _
"WHERE [KEY] = WorkstationsServers.WSID " & _
"ORDER BY RANK DESC "
cmdSearch = New SqlCommand( strSearch, conTorontoHardware )
With cmdSearch.Parameters:
.Add(New SQLParameter("@Dropdown", strField))
.Add(New SQLParameter("@searchphrase", txtSearchphrase.Text))
End With
conTorontoHardware.Open()
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.