473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

URGENT: Command Parameter MySQL full text search.

I have an application where I am required to run a full text query. My
database is MySQL and code in C#. The way all queries are SELECT * FROM

table WHERE firstname = ? and using command parameter the value of ? is

added. But, how would I do the same in case of full text search.
SELECT *, ROUND( MATCH(title, comments) AGAINST (? IN BOOLEAN MODE ) *
10, 2 ) AS score FROM table WHERE MATCH(title,comments) AGAINST (? IN
BOOLEAN MODE ) ORDER BY score DESC
When I provide the value as titl*, I don't get anything. But, when I
hard code the query like:
SELECT *, ROUND( MATCH(title, comments) AGAINST ('titl*' IN BOOLEAN
MODE ) * 10, 2 ) AS score FROM table WHERE MATCH(title,comments)
AGAINST ('titl*' IN BOOLEAN MODE ) ORDER BY score DESC
I get good result.
This is how I am building parameters:
public static OdbcCommand BuildCommand ( ArrayList QueryParameters,
string Query )
{
OdbcCommand Command = new OdbcCommand();
Command.CommandType = CommandType.Text;
Command.CommandText = Query;
for( int i = 0; i <= QueryParameters.Count - 1;
i++ )
{
string[] Parameter =
(string[])QueryParameters[ i ];
Command.Parameters.Add( new
OdbcParameter( Parameter[ 0 ],
Parameter[ 1 ] ) );
}
return Command;
}
Any help will be appreciated.
Thanks.

Jan 12 '06 #1
2 2940
Zeya,

Are you sure you are setting the type of the query parameters properly?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zeya" <ze****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have an application where I am required to run a full text query. My
database is MySQL and code in C#. The way all queries are SELECT * FROM

table WHERE firstname = ? and using command parameter the value of ? is

added. But, how would I do the same in case of full text search.
SELECT *, ROUND( MATCH(title, comments) AGAINST (? IN BOOLEAN MODE ) *
10, 2 ) AS score FROM table WHERE MATCH(title,comments) AGAINST (? IN
BOOLEAN MODE ) ORDER BY score DESC
When I provide the value as titl*, I don't get anything. But, when I
hard code the query like:
SELECT *, ROUND( MATCH(title, comments) AGAINST ('titl*' IN BOOLEAN
MODE ) * 10, 2 ) AS score FROM table WHERE MATCH(title,comments)
AGAINST ('titl*' IN BOOLEAN MODE ) ORDER BY score DESC
I get good result.
This is how I am building parameters:
public static OdbcCommand BuildCommand ( ArrayList QueryParameters,
string Query )
{
OdbcCommand Command = new OdbcCommand();
Command.CommandType = CommandType.Text;
Command.CommandText = Query;
for( int i = 0; i <= QueryParameters.Count - 1;
i++ )
{
string[] Parameter =
(string[])QueryParameters[ i ];
Command.Parameters.Add( new
OdbcParameter( Parameter[ 0 ],
Parameter[ 1 ] ) );
}
return Command;
}
Any help will be appreciated.
Thanks.

Jan 12 '06 #2
Yes. It works for other queries. But fails in this full text search.

Jan 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: karolina | last post by:
Hi, I building a little site using PHP and mysql. Now I want to make full text searches on some columns in one table. The problem is that I have 25 colums in the table that I want to put at...
6
by: lawrence | last post by:
I've spent some time going over this page: http://dev.mysql.com/doc/mysql/en/Data_Manipulation.html And so far it seems the answer is no. So I thought I'd ask here. Does anyone know of any...
0
by: Henry Hank | last post by:
Environment: I'm setting up a database server on a Dell Poweredge 2650, dual 1.8GHZ pentium with 1GB of memory and RAID5 drives. I've installed RedHat 9, and updated the kernel to 2.4.20-19.9smp....
4
by: Michi | last post by:
I was wondering what the best solution is for making large numbers of TEXT (or BLOB?) fields searchable. For example, if I have a forum, what is the best way to be able to search for specific...
13
by: wideangle | last post by:
Hello there! I know it's stupid, but when creating a table in a mysql (win32) database, it won't let me create this "mytable". Here goes my ER_PARSE_ERROR. mysql> CREATE TABLE `mytable` ( ->...
67
by: Bob Powell | last post by:
To whom it may concern: I find the recent articles in various trade publications a little disturbing due to the lack of PostgrSQL mention. I continue to see articles about how IBM may be...
4
by: Vic Cekvenich | last post by:
What would be performance of pgSQL text search vs MySQL vs Lucene (flat file) for a 2 terabyte db? thanks for any comments. ..V -- Please post on Rich Internet Applications User Interface...
5
by: annhere | last post by:
Hi we have a certain SQL script. From that script we have calls like: DROP FUNCTION A@ call sqlj.remove_jar( 'AXML')@ CALL SQLJ.REFRESH_CLASSES()@ call sqlj.install_jar( 'file:C:\AXML.jar',...
7
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.