D
Dirk Vervecken
Hi i've got an application in dotnet that uses
queries from an Access database.
Now most of the common select statements return the desired data,
however, one the queries requires a parameter.
This particular queries does not return the correct data.
I've tested the query in access and it works.
Somehow the parameter that I pass from asp.net does not seem
to be arriving.
This is a sample query of how it looks:
PARAMETER xParam Text(30)
Select * from Table
WHERE param LIKE xparam
xparam contains a *-wildcard at the beginning and end of the string.
And this is how I summon the query
DataSet result = new DataSet();
string searchstring = "*DA*";
OleDbCommand sqlCommand = new OleDbCommand();
sqlCommand = new OleDbCommand("NAME_OF THE
QUERY",(OleDbConnection)conn.Connectie,(OleDbTransaction)conn.Transactie);
sqlCommand.Parameters.Add(new OleDbParameter("xParam", OleDbType.Char,
30));
sqlCommand.Parameters["xParam"].Value = searchstring;
sqlCommand.CommandType = CommandType.StoredProcedure;
this.oleDbDataAdapter1.SelectCommand = sqlCommand;
oleDbDataAdapter1.Fill(result);
I use this way to access other selectqueries that do not use
parameters
and these work just fine. Just the ones with parameters don't work.
Can you help me fix this?
Kind Regards
Dirk Vervecken
(e-mail address removed)
Tel: +32 (0)2/208 02 05
-----
Directie Financiën en Algemene Zaken
Informatica
-----
Vlaamse Gemeenschapscommissie
SaincteletteSquare 17
1000 Brussel
www.digitaalbrussel.be
-----
queries from an Access database.
Now most of the common select statements return the desired data,
however, one the queries requires a parameter.
This particular queries does not return the correct data.
I've tested the query in access and it works.
Somehow the parameter that I pass from asp.net does not seem
to be arriving.
This is a sample query of how it looks:
PARAMETER xParam Text(30)
Select * from Table
WHERE param LIKE xparam
xparam contains a *-wildcard at the beginning and end of the string.
And this is how I summon the query
DataSet result = new DataSet();
string searchstring = "*DA*";
OleDbCommand sqlCommand = new OleDbCommand();
sqlCommand = new OleDbCommand("NAME_OF THE
QUERY",(OleDbConnection)conn.Connectie,(OleDbTransaction)conn.Transactie);
sqlCommand.Parameters.Add(new OleDbParameter("xParam", OleDbType.Char,
30));
sqlCommand.Parameters["xParam"].Value = searchstring;
sqlCommand.CommandType = CommandType.StoredProcedure;
this.oleDbDataAdapter1.SelectCommand = sqlCommand;
oleDbDataAdapter1.Fill(result);
I use this way to access other selectqueries that do not use
parameters
and these work just fine. Just the ones with parameters don't work.
Can you help me fix this?
Kind Regards
Dirk Vervecken
(e-mail address removed)
Tel: +32 (0)2/208 02 05
-----
Directie Financiën en Algemene Zaken
Informatica
-----
Vlaamse Gemeenschapscommissie
SaincteletteSquare 17
1000 Brussel
www.digitaalbrussel.be
-----