#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    21
    Rep Power
    0

    Problems connecting from ASP.net to Oracle


    I have been trying to connect to a Oracle database using ASP.NET. I've been having horrible luck and I can't figure out what my problem is.

    Below are my two attempts, I get the same error for both of them.

    1st attempt
    'get the data
    day1 = Year(Date.Now()) & "-01-01 00:00:00"
    Dim sqlConnectionString As String = "Provider=MSDASQL;user id=myID;password=myPassword;data source=PACPRD;Connect Timeout=30"
    Dim SqlQuery As String = "SELECT D771_HS_EMP_INJURY.PAY_GROUP, D771_HS_EMP_INJURY.DATE_INJURED, D771_HS_EMP_INJURY.BODY_CODE FROM PRDBA.D771_HS_EMP_INJURY D771_HS_EMP_INJURY WHERE (D771_HS_EMP_INJURY.PAY_GROUP='22') AND (D771_HS_EMP_INJURY.DATE_INJURED>={ts '" & day1 & "'}) ORDER BY D771_HS_EMP_INJURY.DATE_INJURED"
    Dim SqlConnection As New SqlConnection(sqlConnectionString)
    Dim sqlData As SqlDataReader
    Dim sqlCommand As New SqlCommand(SqlQuery, SqlConnection)

    SqlConnection.Open()
    sqlData = sqlCommand.ExecuteReader()


    2nd attempt

    'get the data
    day1 = Year(Date.Now()) & "-01-01 00:00:00"
    Dim sqlConnectionString As String = "Provider=OraOLEDB.Oracle;user id=myID;password=myPassWord;data source=PACPRD;Connect Timeout=30"
    Dim SqlQuery As String = "SELECT D771_HS_EMP_INJURY.PAY_GROUP, D771_HS_EMP_INJURY.DATE_INJURED, D771_HS_EMP_INJURY.BODY_CODE FROM PRDBA.D771_HS_EMP_INJURY D771_HS_EMP_INJURY WHERE (D771_HS_EMP_INJURY.PAY_GROUP='22') AND (D771_HS_EMP_INJURY.DATE_INJURED>={ts '" & day1 & "'}) ORDER BY D771_HS_EMP_INJURY.DATE_INJURED"
    Dim SqlConnection As New OleDb.OleDbConnection(sqlConnectionString)
    Dim sqlData As OleDb.OleDbDataReader
    Dim sqlCommand As New OleDb.OleDbCommand(SqlQuery, SqlConnection)

    SqlConnection.Open()
    sqlData = sqlCommand.ExecuteReader()

    Do While sqlData.Read()


    Here is the error that I get:

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [SqlException: SQL Server does not exist or access denied.]
    System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
    System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
    System.Data.SqlClient.SqlConnection.Open() +384
    PowIntranet.testVMLChart.SQLPieChart(String sChartTitle, Object& numericValues, Object& textValues, Int32& iNumberOfValues, Boolean isLegend, Int32& Total) in C:\Documents and Settings\jcyatema\VSWebCache\powintranet\Powell\Production\ProductionReports\Qmr\_Test\Charts\VMLCha rt.aspx.vb:616
    PowIntranet.testVMLChart.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\jcyatema\VSWebCache\powintranet\Powell\Production\ProductionReports\Qmr\_Test\Charts\VMLCha rt.aspx.vb:138
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +35
    System.Web.UI.Page.ProcessRequestMain() +731




    If anyone can help I'd be very happy
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,183
    Rep Power
    2220
    Moved to the .NET forum from Beginners
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn

IMN logo majestic logo threadwatch logo seochat tools logo