locked
Retrieving Image using Data Access Block RRS feed

  • Question

  • User-1997257248 posted

    Hello,

    I'm having problems retrieving images from my Oracle Database.

    My code is as follows,

    public byte[] GetEmployeeImage(string v_employeeId)
    {
    object image = null;
    Database l_database = DatabaseFactory.CreateDatabase();
    string sql = "SELECT PATIENTPIC FROM PA_PTNTDETAIL WHERE PATIENTID= :PatientID";
    DBCommandWrapper l_dbCommandWrapper = l_database.GetSqlStringCommandWrapper(sql);
    l_dbCommandWrapper.AddInParameter(":PatientID", DbType.AnsiString, v_employeeId);

    try
    {
    image = l_database.ExecuteScalar(l_dbCommandWrapper);
    }
    catch (Exception ex)
    {
    string msg = ex.Message;
    }
    return (byte[]) image;
    }

    When I execute the above method I get the following error,

    System.ComponentModel.Win32Exception: Access is denied

    any idea on where the problem is? Is my code ok?

    Saturday, February 18, 2006 12:21 PM

All replies

  • User-1997257248 posted
    Hey, the solution for the problem is as follows. Hope this is useful.

    Problem: System.ComponentModel.Win32Exception: Access is denied
    Solution :
    Execute regedt32 through Start | Run and navigate to the registry key,  <o:p></o:p>

    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib. Then select the Edit | Permissions menu item. In the dialog that comes up, assign Full Control to the ASPNET user. If you don't see ASPNET in the list at the top of the dialog, use the Add button to add it from your local machine. Then allow Full Control access and click OK.

    I'm using Windows XP Professional.

    Has anyone tried this with Windows 2000 family? Last week, I was trying to apply this solution on our server which runs on Windows 2000 Server. However, there was no Edit | Permissions menu at all.

    Thanks,
    Tuesday, March 14, 2006 7:40 AM