Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Problems with Sandbox Mode

Problems with Sandbox Mode

Scheduled Pinned Locked Moved Database
databasehelpcsharpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blakeb_1
    wrote on last edited by
    #1

    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

    M M C 3 Replies Last reply
    0
    • B blakeb_1

      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

      M Offline
      M Offline
      monrobot13
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • B blakeb_1

        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

        M Offline
        M Offline
        Mike Dimmick
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • B blakeb_1

          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

          C Offline
          C Offline
          Chris Meech
          wrote on last edited by
          #4

          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 2

          Not 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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups