Page 1 of 1

mimic SQL Server SelectCommand.Parameters

Posted: Tue 10 May 2005 19:22
by darling1906
I am new to using your product so I have a question..

I have a app built in asp.net and SQL server that I am trying to move over to mysql. I have your professional 2.8 installed and write in C#

Now.. my question is in my select query I am saying:

Select * from table where (field = :field);

I am passing variables from page to page

I want my query to run based on the value passed.

In SQL sever its simply

SqlDataAdapter1.SelectCommand.Parameters["@field"].Value = variable;

I tried doing the same suing your product and I get errors..

i am replacing ["@field"] with [":field"] and saying
mySqlDataAdapter1.SelectCommand.Parameters[":field"].Value = variable;

can anyone help???

Posted: Wed 11 May 2005 06:34
by Serious
Use

Code: Select all

mySqlDataAdapter1.SelectCommand.Parameters["field"].Value = variable; 
Please see "Using parameters" article in MySQLDirect .NET help.