Using Access queries via asp.net

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
-----
 
D

Dirk Vervecken

I've tried that. I've placed *'s directly in the access query. No
succes. It simply seems as though the info
in the parameter is not passed from the .net application
to Access.


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top