help with access and C# error

E_Gold

Registered User.
Local time
Today, 19:07
Joined
Sep 18, 2010
Messages
26
hi

i try to reverse string on access in sql query and C# like this:

SQL = "SELECT StrReverse(Des) from MyTbl";
dsView = new DataSet();
adp = new OleDbDataAdapter(SQL, Main.Conn);
adp.Fill(dsView, "MyTbl");
adp.Dispose();
dataGridView1.DataSource = dsView.Tables["MyTbl"].DefaultView;

and i get this error: Undefined function 'StrReverse' in expression.

but if i run this query on access its works excellent

what can be the problem ?
 
I don't believe you can use Embedded Access Functions from .NET in this manner. You need to retrieve the data and do the transform using the equivalent .NET function.

Access is basically an Application Layer that sits on top of the underlying Database engine and the function is part of that Access Layer which you're bypassing in your .NET application to talk directly to the database engine.

[edit] Just to expand on this, even if you put all the SQL in a query in an access database, you still can't use Access specific functions if you're calling the query from .NET (though there may be a reference you could add that would enable that functionality, I've not tried). Standard SQL functions like COUNT(), SUM() etc are fine.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom