473,382 Members | 1,766 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,382 software developers and data experts.

Undefined function 'InStrRev' in expression.

Hi Experts,

Connected to Access MDB file using ADO.net OLEDB, I have a SQL to get
file extension from file name which is stored as field.
SELECT Right(FileName, Len(FileName) - InStrRev(FileName, '.')) FROM
Files

This query work in MS ACCESS enivronment but not VB.net program
connecting to the database.

StrReverse / Reverse don't work neither

Your help is highly appreciated.

Alan Wo
http://noclone.net

Jun 14 '06 #1
7 5007
CT
Alan,

Have a look at the Substring and the LastIndexOf methods of the String
class.

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
<al****@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi Experts,

Connected to Access MDB file using ADO.net OLEDB, I have a SQL to get
file extension from file name which is stored as field.
SELECT Right(FileName, Len(FileName) - InStrRev(FileName, '.')) FROM
Files

This query work in MS ACCESS enivronment but not VB.net program
connecting to the database.

StrReverse / Reverse don't work neither

Your help is highly appreciated.

Alan Wo
http://noclone.net

Jun 14 '06 #2
Hi,

Do you have more code around this.

I don't know if this is meant as SQL Select string, in that case it could be
something as

"SELECT " & Right(FileName, Len(FileName) - InStrRev(FileName, '.')) &
"FROM
Files "

However I am not sure if you are after this.

Cor

This query work in MS ACCESS enivronment but not VB.net program
connecting to the database.

StrReverse / Reverse don't work neither

Your help is highly appreciated.

Alan Wo
http://noclone.net

Jun 14 '06 #3
On 14 Jun 2006 05:09:22 -0700, al****@gmail.com wrote:

¤ Hi Experts,
¤
¤ Connected to Access MDB file using ADO.net OLEDB, I have a SQL to get
¤ file extension from file name which is stored as field.
¤ SELECT Right(FileName, Len(FileName) - InStrRev(FileName, '.')) FROM
¤ Files
¤
¤ This query work in MS ACCESS enivronment but not VB.net program
¤ connecting to the database.
¤
¤ StrReverse / Reverse don't work neither
¤
¤ Your help is highly appreciated.

Jet supports a number of VBA type functions in sandbox mode. Unfortunately InStrRev is not supported
when running a SQL query outside of Access. Only the InStr string function is supported.

I would recommend using the .NET functions that Carsten suggested *after* retrieving the full
filename from the database.
Paul
~~~~
Microsoft MVP (Visual Basic)
Jun 14 '06 #4
Paul

Great, you understood my problem. Sure, we can do some post-processing
after retrieving the full file name, but if it can be done in SQL
statement, it is faster. In an attempt to do so, I tried to use
StrReverse function plus InStr to do the same result, but StrReverse is
not supported through ado.net but only in MS Access environment or
"sandbox". Do you know the function to reverse string or could you give
me the web page that list all built-in functions that can be used
through ado.net/oledb using mdb database? Do you know the equivalence
of InStrRev using combination of supported functions?
Thanks again.

Alan Wo
http://noclone.net

Paul Clement wrote:
On 14 Jun 2006 05:09:22 -0700, al****@gmail.com wrote:

¤ Hi Experts,
¤
¤ Connected to Access MDB file using ADO.net OLEDB, I have a SQL to get
¤ file extension from file name which is stored as field.
¤ SELECT Right(FileName, Len(FileName) - InStrRev(FileName, '.')) FROM
¤ Files
¤
¤ This query work in MS ACCESS enivronment but not VB.net program
¤ connecting to the database.
¤
¤ StrReverse / Reverse don't work neither
¤
¤ Your help is highly appreciated.

Jet supports a number of VBA type functions in sandbox mode. Unfortunately InStrRev is not supported
when running a SQL query outside of Access. Only the InStr string function is supported.

I would recommend using the .NET functions that Carsten suggested *after*retrieving the full
filename from the database.


Paul
~~~~
Microsoft MVP (Visual Basic)


Jun 14 '06 #5
On 14 Jun 2006 09:40:28 -0700, al****@gmail.com wrote:

¤ Paul
¤
¤ Great, you understood my problem. Sure, we can do some post-processing
¤ after retrieving the full file name, but if it can be done in SQL
¤ statement, it is faster. In an attempt to do so, I tried to use
¤ StrReverse function plus InStr to do the same result, but StrReverse is
¤ not supported through ado.net but only in MS Access environment or
¤ "sandbox". Do you know the function to reverse string or could you give
¤ me the web page that list all built-in functions that can be used
¤ through ado.net/oledb using mdb database? Do you know the equivalence
¤ of InStrRev using combination of supported functions?

The string manipulation functions are rather limited under Jet. I took a quick look but I didn't see
anything that triggered an idea. If you want to see what is available check the following MS KB
article:

How to configure Jet 4.0 to prevent unsafe functions from running in Access 2003
http://support.microsoft.com/default...d=kb;ja;294698
Paul
~~~~
Microsoft MVP (Visual Basic)
Jun 14 '06 #6
Hi Paul,

Thank you very much for your valuable information. I know more about
the issue. I found that InStrRev is disabled in sandbox mode but
setting
\\HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\en gines\SandboxMode to
0 does not work.
http://office.microsoft.com/en-us/as...spx?mode=print
Alan

Paul Clement wrote:
On 14 Jun 2006 09:40:28 -0700, al****@gmail.com wrote:

¤ Paul
¤
¤ Great, you understood my problem. Sure, we can do some post-processing
¤ after retrieving the full file name, but if it can be done in SQL
¤ statement, it is faster. In an attempt to do so, I tried to use
¤ StrReverse function plus InStr to do the same result, but StrReverse is
¤ not supported through ado.net but only in MS Access environment or
¤ "sandbox". Do you know the function to reverse string or could you give
¤ me the web page that list all built-in functions that can be used
¤ through ado.net/oledb using mdb database? Do you know the equivalence
¤ of InStrRev using combination of supported functions?

The string manipulation functions are rather limited under Jet. I took a quick look but I didn't see
anything that triggered an idea. If you want to see what is available check the following MS KB
article:

How to configure Jet 4.0 to prevent unsafe functions from running in Access 2003
http://support.microsoft.com/default...d=kb;ja;294698


Paul
~~~~
Microsoft MVP (Visual Basic)


Jun 15 '06 #7
Hi All,

We finally work around a solution, store the dot position returned by
..net string function in database during insertion. This avoid the time
to process after retrieval while keeping the lowest storage.

Alan
http://noclone.net
al****@gmail.com wrote:
Hi Paul,

Thank you very much for your valuable information. I know more about
the issue. I found that InStrRev is disabled in sandbox mode but
setting
\\HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\en gines\SandboxMode to
0 does not work.
http://office.microsoft.com/en-us/as...spx?mode=print
Alan

Paul Clement wrote:
On 14 Jun 2006 09:40:28 -0700, al****@gmail.com wrote:

¤ Paul
¤
¤ Great, you understood my problem. Sure, we can do some post-processing
¤ after retrieving the full file name, but if it can be done in SQL
¤ statement, it is faster. In an attempt to do so, I tried to use
¤ StrReverse function plus InStr to do the same result, but StrReverse is
¤ not supported through ado.net but only in MS Access environment or
¤ "sandbox". Do you know the function to reverse string or could you give
¤ me the web page that list all built-in functions that can be used
¤ through ado.net/oledb using mdb database? Do you know the equivalence
¤ of InStrRev using combination of supported functions?

The string manipulation functions are rather limited under Jet. I took a quick look but I didn't see
anything that triggered an idea. If you want to see what is available check the following MS KB
article:

How to configure Jet 4.0 to prevent unsafe functions from running in Access 2003
http://support.microsoft.com/default...d=kb;ja;294698


Paul
~~~~
Microsoft MVP (Visual Basic)


Jun 16 '06 #8

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

Similar topics

3
by: mal_lori | last post by:
Hello, I have an ongoing problem with a single machine not recognizing the REPLACE function. This is a WinXP Pro machine, running Office 2000 (SP3) with MDAC 2.8 (SR1) and Jet 4 installed. ...
3
by: Mantorok Redgormor | last post by:
In this context would an indeterminate value lead down the path to undefined behavior? (void)foo->member; I want to keep my interface consisent in my program so I have this one function which...
12
by: RoSsIaCrIiLoIA | last post by:
On Mon, 07 Feb 2005 21:28:30 GMT, Keith Thompson <kst-u@mib.org> wrote: >"Romeo Colacitti" <wwromeo@gmail.com> writes: >> Chris Torek wrote: >>> In article <4205BD5C.6DC8@mindspring.com> >>>...
10
by: Michael B Allen | last post by:
I have some code: *str++ = tolower(*str); that gcc is complaining about: warning: operation on `str' may be undefined I'm getting similar warnings for 'di' and 'bi' in:
14
by: avsharath | last post by:
In "Bjarne Stroustrup's C++ Style and Technique FAQ" at: http://www.research.att.com/~bs/bs_faq2.html#evaluation-order for the statement: f(v,i++); he says that "the result is undefined...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to...
12
by: Rajesh S R | last post by:
Can anyone tell me what is the difference between undefined behavior and unspecified behavior? Though I've read what is given about them, in ISO standards, I'm still not able to get the...
0
by: John | last post by:
Hi I have written a function to split a string into sub strings of a given fixed max length. This is useful for example in breaking a long message into multiple strings of up to 160 characters...
33
by: coolguyaroundyou | last post by:
Will the following statement invoke undefined behavior : a^=b,b^=a,a^=b ; given that a and b are of int-type ?? Be cautious, I have not written a^=b^=a^=b ; which, of course, is undefined....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.