Problems with Sandbox Mode
-
Hello, I have a question about querying an Access database from a .Net program. I am using C#. What I want to be able to do is use the instrrev() function in an sql query to find the first period from the right of a string (to get the extension from and e-mail address). However, anytime i try to use instrrev I get an error saying that instrrev is an unknown function. I don't get this error when I use instr(). I researched on the internet and decided that this must be caused by the sandbox mode in the jet engine, so I turned sandbox mode off in Access. However, I still the get the same error when running the query from my C# program. Does anyone know how I can use this function, or is there any other way to solve my problem? I thought about using strreverse() and the using instr(), but it turns out that strreverse() is another function that won't work. Any help is appreciated. Thanks! Blake
-
Hello, I have a question about querying an Access database from a .Net program. I am using C#. What I want to be able to do is use the instrrev() function in an sql query to find the first period from the right of a string (to get the extension from and e-mail address). However, anytime i try to use instrrev I get an error saying that instrrev is an unknown function. I don't get this error when I use instr(). I researched on the internet and decided that this must be caused by the sandbox mode in the jet engine, so I turned sandbox mode off in Access. However, I still the get the same error when running the query from my C# program. Does anyone know how I can use this function, or is there any other way to solve my problem? I thought about using strreverse() and the using instr(), but it turns out that strreverse() is another function that won't work. Any help is appreciated. Thanks! Blake
Well if all else fails you could just write your own function to find the first instance of a period from the end of the string. This isn't C#, but should give you an idea.
int FindCharRev (const CString str, const char c, CString& buf)
{
char* pStr;
int index, j = 0, len = str.GetLength ();
for (int i = len; i > 0; i--) {
if (str[i] == c)
{ index = i; break; }
}pStr = (LPTSTR)(LPCTSTR)str; pStr += index; while (pStr) { buf\[j\] = \*pStr; pStr++; j++; } return index
}
That's a crude implementation, but it should put the string after the first instance (from the end of the string) of a character in the "buf" parameter and return the index of where that character was found. - Aaron
-
Hello, I have a question about querying an Access database from a .Net program. I am using C#. What I want to be able to do is use the instrrev() function in an sql query to find the first period from the right of a string (to get the extension from and e-mail address). However, anytime i try to use instrrev I get an error saying that instrrev is an unknown function. I don't get this error when I use instr(). I researched on the internet and decided that this must be caused by the sandbox mode in the jet engine, so I turned sandbox mode off in Access. However, I still the get the same error when running the query from my C# program. Does anyone know how I can use this function, or is there any other way to solve my problem? I thought about using strreverse() and the using instr(), but it turns out that strreverse() is another function that won't work. Any help is appreciated. Thanks! Blake
It sounds like you're trying to get your database to do too much work. If this is in the presentation part of the SELECT, not in any selection clauses (WHERE, HAVING, ON), do it in the C# code once you've got the results. Stability. What an interesting concept. -- Chris Maunder
-
Hello, I have a question about querying an Access database from a .Net program. I am using C#. What I want to be able to do is use the instrrev() function in an sql query to find the first period from the right of a string (to get the extension from and e-mail address). However, anytime i try to use instrrev I get an error saying that instrrev is an unknown function. I don't get this error when I use instr(). I researched on the internet and decided that this must be caused by the sandbox mode in the jet engine, so I turned sandbox mode off in Access. However, I still the get the same error when running the query from my C# program. Does anyone know how I can use this function, or is there any other way to solve my problem? I thought about using strreverse() and the using instr(), but it turns out that strreverse() is another function that won't work. Any help is appreciated. Thanks! Blake
My Oracle docs on INSTR say that you pass a negative value for the third parameter, and the search will be done from the end of the string.
select instr('CORPORATE FLOOR,'OR',-3,2) from dual
will a return a value of 2Not sure if this is the same in access, though. :~ Chris Meech We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler