Solved

Specified driver could not be loaded due to system error 5 (Oracle in OraHome92

Posted on 2004-10-28
311 Views
Last Modified: 2012-06-27
I have a C# application and I am migrating it to another machine. It seems to be an issue when I create the odbc connection, with compatibility. I am not sure. But I am stuck on this problem and it is driving me nuts. I am sure that someone has solved this problem before. I would appreciate any immediate response.


======================================================
Server Error in '/MSPOS' Application.
--------------------------------------------------------------------------------

ERROR [IM003] Specified driver could not be loaded due to system error 5 (Oracle in OraHome92).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.Odbc.OdbcException: ERROR [IM003] Specified driver could not be loaded due to system error 5 (Oracle in OraHome92).

Source Error:


Line 73: {
Line 74:      OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
Line 75:     myConnection.Open();
Line 76:        
Line 77:     // get records from the table
 

Source File: D:\Inetpub\wwwroot\MSPOS\Stores.aspx    Line: 75

Stack Trace:


[OdbcException: ERROR [IM003] Specified driver could not be loaded due to system error  5 (Oracle in OraHome92).]
   System.Data.Odbc.OdbcConnection.Open() +638
   ASP.Stores_aspx.BindData() in D:\Inetpub\wwwroot\MSPOS\Stores.aspx:75
   ASP.Stores_aspx.Page_Load(Object sender, EventArgs e) in D:\Inetpub\wwwroot\MSPOS\Stores.aspx:64
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Request Details
Session Id: yy1gqs45c0hhs555vgnb0b45 Request Type: GET
Time of Request: 10/28/2004 2:56:47 AM Status Code: 500
Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)
Trace Information
Category Message From First(s) From Last(s)
aspx.page Begin Init  
aspx.page End Init 0.000168 0.000168
Unhandled Execution Error
ERROR [IM003] Specified driver could not be loaded due to system error  5 (Oracle in OraHome92).
  at System.Data.Odbc.OdbcConnection.Open()
  at ASP.Stores_aspx.BindData() in D:\Inetpub\wwwroot\MSPOS\Stores.aspx:line 75
  at ASP.Stores_aspx.Page_Load(Object sender, EventArgs e) in D:\Inetpub\wwwroot\MSPOS\Stores.aspx:line 64
  at System.Web.UI.Control.OnLoad(EventArgs e)
  at System.Web.UI.Control.LoadRecursive()
  at System.Web.UI.Page.ProcessRequestMain()
==========================================================================



Now here is my code:

<%@ Page Language="c#" trace="true" %>
<%@ Register TagPrefix="uc1" TagName="logout" Src="Engine/Controls/logout.ascx" %>
<%@ import namespace="System.Data.Odbc" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.SessionState" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.ComponentModel" %>
<%@ import namespace="System.Collections" %>
<%@ import namespace="System.Text" %>
<%@ import namespace="System.Data" %>
<%@ Register TagPrefix="mspos" TagName="header" Src="~/Engine/Controls/header.ascx" %>
<%@ Register TagPrefix="mspos" TagName="footer" Src="~/Engine/Controls/footer.ascx" %>
<HTML>
<HEAD>
<title>Users Interface to Managing Adminitrators</title>
<meta content="True" name="vs_snapToGrid">
<script language="C#" runat="server">
protected string AccessLevel = null;
private DataSet ddlDataSet = new DataSet();
private OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
private DataSet ddlDataSet1 = new DataSet();

private void MainMenu_Click(Object sender, ImageClickEventArgs e)
{
   AccessLevel = Session["Authenticated"].ToString();
     if (AccessLevel == "1")
          Response.Redirect("AdminStart.aspx");        
     else if (AccessLevel == "2")
          Response.Redirect("CCManStart.aspx");        
     else if (AccessLevel == "3")
          Response.Redirect("CCashierStart.aspx");        
     else if (AccessLevel == "4")
          Response.Redirect("CashierStart.aspx");        
     else Response.Redirect("Error.aspx");
}

//************************************************************
// Get Stores and populate dataset with STOREID and Store
private DataSet BindStores()
{
     OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");

    // Populate the ddlDataSet
   myConnection.Open();
   const string strSQLDDL = @"SELECT STOREID, STORE FROM TBSTORES ORDER BY STOREID";
   OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
   ddlDataSet1.Clear();  
   myDataAdapter.Fill(ddlDataSet1, "ddlStores");
   myDataAdapter.Dispose();
   myDataAdapter = null;
   myConnection.Close();
   return ddlDataSet1;
}
//************************************************************
 
 
 
//****************************************************************
protected void Page_Load(object sender, System.EventArgs e)
{
     if (!Page.IsPostBack)
     {
          BindData();
     }
}
//****************************************************************



//****************************************************************
private void BindData()
{
     OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
    myConnection.Open();
       
    // get records from the table
    string commandString = @"SELECT STOREID, STORE FROM TBSTORES ORDER BY STOREID";    
    // Set the datagrid's datasource to the datareader and databind
    // Create a OdbcCommand object and assign the connection connect to the database
    OdbcCommand command = myConnection.CreateCommand( );
    command.CommandText = commandString;
    command.Connection = myConnection;
     // Create the Reader and bind it to the datagrid
    OdbcDataReader reader =  command.ExecuteReader(CommandBehavior.CloseConnection);
    DataGridUserManagementID.DataSource=reader;
    DataGridUserManagementID.DataBind();
     reader.Close();
     reader=null;
    myConnection.Dispose();
     myConnection.Close();
         
}
//****************************************************************

//************************************************************
private void DataGridUserManagementID_SelectedIndexChanged(object sender, System.EventArgs e)
{
     int intCount;
     for (intCount = 1; intCount <= DataGridUserManagementID.Items.Count; intCount ++)
         DataGridUserManagementID.Items[intCount - 1].BorderStyle =  BorderStyle.Groove;

     DataGridUserManagementID.SelectedItem.BorderStyle = BorderStyle.Dashed;
}
//************************************************************



//****************************************************************
private void DataGridUserManagementID_Delete(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    // Get the StoreID of the row whose Delete button was clicked
   
    string strStoreID = ((Label)e.Item.FindControl("lblStoreID")).Text;
    int SelectedStoreID = Convert.ToInt32(strStoreID);
     string strSQL="Delete From TBSTORES where STOREID='"+ SelectedStoreID +"'";
    ExecuteQuery(strSQL);
    DataGridUserManagementID.EditItemIndex = -1;
    BindData();
}
//****************************************************************



//***************************************************************
private int ExecuteQuery(string sqlCmd)
{
   // Create a OdbcCommand object and assign the connection connect to the database
   OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
   myConnection.Open();
   OdbcCommand command = myConnection.CreateCommand( );
   command.CommandText = sqlCmd;
   command.Connection = myConnection;
   return command.ExecuteNonQuery();
}
//***************************************************************



//***************************************************************
private void DataGridUserManagementID_Update(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    // Determine what store was selected
    string strStoreID, strStore;
    // Declare Textboxes
      // Gets the value of the key field of the row being updated
     strStoreID = ((Label)e.Item.FindControl("lblStoreID")).Text;
    strStore = ((TextBox)e.Item.FindControl("editStores")).Text;    
     
   
     // form the update statement
    // connect to the database
     string cmd="Update TBSTORES Set STORE='"+ strStore +"' Where StoreID = "+ strStoreID +"";
        ExecuteQuery(cmd);
        DataGridUserManagementID.EditItemIndex = -1;
    BindData(  );
   
}
//************************************************************************



//************************************************************************
protected int GetSelectedIndexStore(string StoreID)
{  
   int iLoop;  
   DataTable dt = ddlDataSet1.Tables["ddlStores"];  
   for (iLoop=0; iLoop < dt.Rows.Count - 1; iLoop++)
   {  
          if (StoreID.Equals(dt.Rows[iLoop]["STOREID"].ToString()))  
            return iLoop;  
   };  
   return 0;  
 
}
//***************************************************************


//****************************************************************
private void DataGridUserManagementID_Edit(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
     DataGridUserManagementID.EditItemIndex = e.Item.ItemIndex;
    BindData();
}
//****************************************************************



//************************************************************************
protected void DataGridUserManagementID_ItemCreated(Object sender, DataGridItemEventArgs e)
{
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
     {
          ImageButton btn = (ImageButton)e.Item.FindControl("btnDel");
         btn.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item.')");
     }
}
//************************************************************************


//******************************************************************************
private void DataGridUserManagementID_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    ListItemType oType = ((ListItemType)e.Item.ItemType);
    if(oType == ListItemType.Item || oType == ListItemType.AlternatingItem)
    {
          e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue'");            
          e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Beige'");            
     }


}
//***************************************************************


//************************************************************************
protected void DataGridUserManagementID_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{

    if (e.CommandName == "Insert")
    {
       TextBox txtStore;
       ///... declarations for remaining data fields
 
       string strSQL;
        string storename;
       
        txtStore = (TextBox)e.Item.FindControl("add_storeID");
       storename = txtStore.Text;
       OdbcCommand command = myConnection.CreateCommand( );
        command.Connection = myConnection;
       
       // Create the appropriate SQL statement
       strSQL = "INSERT INTO TBSTORES (STORE) VALUES ('" +storename+"'"+")";
       if (storename != "")
               ExecuteQuery(strSQL);
       DataGridUserManagementID.EditItemIndex = -1;
       BindData();
    }
}
//************************************************************************


//****************************************************************
private void DataGridUserManagementID_Cancel(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    DataGridUserManagementID.EditItemIndex = -1;
    BindData();
}
//****************************************************************

          </script>
</HEAD>
<body bgColor="#fef9e9" leftMargin="0" background="images/bg.gif" topMargin="0" marginwidth="0"
          marginheigh="0">
<mspos:header id="header" runat="server"></mspos:header>
<center>
<form id="form1" runat="server">
<TABLE height="380" cellSpacing="0" cellPadding="0" width="587" border="0" ms_2d_layout="TRUE">
<TR vAlign="top">
<TD width="368" height="29">
<!-- Include start of header --------------------------------------------></TD>
<TD width="575" height="29">
<P align="center"><BR>
<asp:imagebutton id="Imagebutton1" onclick="MainMenu_Click" runat="server" ImageUrl="images/main.jpg"></asp:imagebutton><BR>
<BR>
</P>
</TD>
<TD width="702" height="29"></TD>
</TR>
<TR vAlign="top">
<TD width="368" height="272"></TD>
<TD width="575" height="272"><asp:datagrid id="DataGridUserManagementID" runat="server" BorderWidth="3" BorderColor="#CCCC99"
                                        PagerStyle-HorizontalAlign="Right" width="449px" font-names="Verdana" font-size="xx-small"
                                        BorderStyle="Outset" GridLines="None" AutoGenerateColumns="False" ShowFooter="True" AllowCustomPaging="True"
                                        AllowPaging="True" OnItemCommand="DataGridUserManagementID_ItemCommand" OnItemCreated="DataGridUserManagementID_ItemCreated"
                                        OnEditCommand="DataGridUserManagementID_Edit" OnItemDataBound="DataGridUserManagementID_ItemDataBound"
                                        OnCancelCommand="DataGridUserManagementID_Cancel" OnUpdateCommand="DataGridUserManagementID_Update"
                                        OnDeleteCommand="DataGridUserManagementID_Delete">
<FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>
<ItemStyle BackColor="Beige"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#954896"></HeaderStyle>
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="&lt;img src=images/Ok.gif border=0 align=absmiddle alt='Save changes'&gt;"
                                                  CancelText="&lt;img src=images/Cancel.gif border=0 align=absmiddle alt='Cancel editing'&gt;"
                                                  EditText="&lt;img src=images/icn_edit.gif border=0 align=absmiddle alt='Edit this item'&gt;"></asp:EditCommandColumn>
<asp:TemplateColumn HeaderText="StoreID">
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "STOREID")) %>' Font-Bold="true" Runat="server" ID="lblStoreID">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Store Name">
<ItemTemplate>
<asp:Label id=lblStore Runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"STORE")) %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id="add_storeID" Width="150" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox id=editStores Width="150" Runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"STORE")) %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Delete">
<ItemTemplate>
<asp:ImageButton CommandName="Delete" id="btnDel" runat="server" Runat="server" alt='Delete this item?'
                                                            ImageUrl="images/icn_del.gif"></asp:ImageButton>
</ItemTemplate>
<FooterTemplate>
<asp:ImageButton CommandName="Insert" id="btnAdd" runat="server" alt='Add new item' ImageUrl="images/icn_add.gif"></asp:ImageButton>
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
</asp:datagrid>
<P align="center">
<uc1:logout id="Logout1" runat="server"></uc1:logout><BR>
<BR>
<mspos:footer id="footer" runat="server"></mspos:footer></P>
</TD>
<TD height="272"></TD>
</TR>
</TABLE>
</form>
</center> <!-- Include start of footer ------------------------------------------------> <!--------------------------------------------------------------------------->
</body>
</HTML>
0
Question by:mathieu_cupryk
    1 Comment
     
    LVL 6

    Accepted Solution

    by:
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

    911 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now