none
Error :Invalid procedure call while excuting in ms access RRS feed

  • Question

  •  

    hello frnds,

    I m facing serious problem while excauting the following code

     

     

    public bool AdjustFilmNumMemberHistory()

    {

    string TempStore = storeNum.Substring(4, 2);

    string strSQL = "UPDATE MemberHistory SET MemberHistory.FilmNumber = ";

    strSQL = strSQL + "iif((Len(FilmNumber)=10 OR Len(FilmNumber) = 9), ";

    strSQL = strSQL + "FilmNumber, ";

    strSQL = strSQL + "mid('"+ TempStore +"'+Right(String ((8-Len(FilmNumber)), 0) & FilmNumber,8) ,1,10))";

    System.Data.OleDb.OleDbDataReader result;

    System.Data.OleDb.OleDbCommand WinRentCommand = new System.Data.OleDb.OleDbCommand(strSQL, conn);

    try

    {

    result = (System.Data.OleDb.OleDbDataReader)WinRentCommand.ExecuteReader();

    }

    catch (Exception Ex)

    {

    AppExceptions WinRentalEx = new AppExceptions(Ex.Message, Ex);

    return false;

    }

    result.Close();

    return true;

    }

     

     

    its not excuting the query .

    it throughs the invalid procedure call exception .

     

    Plz reply me with solution

    thnx In advance .

     

     

     

     

     

    Friday, November 23, 2007 1:16 PM

Answers

  • There is a "+" character which precedes the Right function. That looks like a syntax error to me.

     

    Monday, November 26, 2007 2:11 PM

All replies

  • There is a "+" character which precedes the Right function. That looks like a syntax error to me.

     

    Monday, November 26, 2007 2:11 PM
  • Keep in mind that VBA functions, like MID, RIGHT etc, are not supported by Jet OLEDB provider. Those queries will run inside of Access, but will fail when you execute them using Jet OLEDB.

    Monday, November 26, 2007 8:04 PM
    Moderator
  • Certain functions are available (such as Mid and Right) but you need to keep track of which ones can and can't be used.

     

    http://support.microsoft.com/kb/239482

     

     

     

    Monday, November 26, 2007 8:52 PM