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. Web Development
  3. ASP.NET
  4. Connection String Failing.

Connection String Failing.

Scheduled Pinned Locked Moved ASP.NET
visual-studiohelpcsharpdatabasesysadmin
4 Posts 2 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.
  • J Offline
    J Offline
    japel
    wrote on last edited by
    #1

    OK this one has me stuck In the below code I am pointing to a Access DB in the App_Data folder in the root of my web site. When I run the code it errors telling me that the dbo.mdb if not in "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" If I rename my "ShowroomRegDB" Access Db to dbo.mdb and copy to the path it is looking all is fine???? Why is it not using the connection path I have placed in the Connection String??? Please help..... Dim strConn As String = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/ShowroomRegDb.mdb")) Dim oleConn As New OleDbConnection(strConn) Dim oleComm As New OleDb.OleDbCommand oleComm.Connection = oleConn Try oleConn.Open() oleComm.CommandText = ("SELECT Important FROM dbo.ConfigTb WHERE ConfigID = 1") Dim Important As String = Convert.ToString(oleComm.ExecuteScalar()) oleComm.CommandText = ("SELECT COUNT(*) FROM dbo.IssueTb WHERE Closed = FALSE") Dim count As Integer = Convert.ToInt32(oleComm.ExecuteScalar()) oleComm.CommandText = ("SELECT COUNT(*) FROM dbo.SuggestionTb WHERE SugClosed = FALSE") Dim count1 As Integer = Convert.ToInt32(oleComm.ExecuteScalar()) oleConn.Close() labIssueNumber.Text = count.ToString labSugNum.Text = count1.ToString labImportant.Text = Important.ToString Catch ex As OleDbException labError.Text = ex.Message End Try

    When people make you see red, be thankful your not colour blind.

    J 1 Reply Last reply
    0
    • J japel

      OK this one has me stuck In the below code I am pointing to a Access DB in the App_Data folder in the root of my web site. When I run the code it errors telling me that the dbo.mdb if not in "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" If I rename my "ShowroomRegDB" Access Db to dbo.mdb and copy to the path it is looking all is fine???? Why is it not using the connection path I have placed in the Connection String??? Please help..... Dim strConn As String = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/ShowroomRegDb.mdb")) Dim oleConn As New OleDbConnection(strConn) Dim oleComm As New OleDb.OleDbCommand oleComm.Connection = oleConn Try oleConn.Open() oleComm.CommandText = ("SELECT Important FROM dbo.ConfigTb WHERE ConfigID = 1") Dim Important As String = Convert.ToString(oleComm.ExecuteScalar()) oleComm.CommandText = ("SELECT COUNT(*) FROM dbo.IssueTb WHERE Closed = FALSE") Dim count As Integer = Convert.ToInt32(oleComm.ExecuteScalar()) oleComm.CommandText = ("SELECT COUNT(*) FROM dbo.SuggestionTb WHERE SugClosed = FALSE") Dim count1 As Integer = Convert.ToInt32(oleComm.ExecuteScalar()) oleConn.Close() labIssueNumber.Text = count.ToString labSugNum.Text = count1.ToString labImportant.Text = Important.ToString Catch ex As OleDbException labError.Text = ex.Message End Try

      When people make you see red, be thankful your not colour blind.

      J Offline
      J Offline
      Jakob Farian Krarup
      wrote on last edited by
      #2

      Try adding a "/" to the beginning of your connection string Dim strConn As String = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/App_Data/ShowroomRegDb.mdb")) This tells the webserver to look in the root of your webfolder.

      Kind regards - Jakob :cool: ********************************************* Three kinds of people in the world: - Those who can count.. - Those who can't! 10 kinds of people in the world: - Those who understand binary - Those who don't

      J 1 Reply Last reply
      0
      • J Jakob Farian Krarup

        Try adding a "/" to the beginning of your connection string Dim strConn As String = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/App_Data/ShowroomRegDb.mdb")) This tells the webserver to look in the root of your webfolder.

        Kind regards - Jakob :cool: ********************************************* Three kinds of people in the world: - Those who can count.. - Those who can't! 10 kinds of people in the world: - Those who understand binary - Those who don't

        J Offline
        J Offline
        japel
        wrote on last edited by
        #3

        No Good It also fails if i put the absolute path "C:\Inetpub\wwwroot\ShowroomRegister\App_Data\ShowroomRegDB" Very Strange... I know the Connection string works but it keeps looking for dbo.mdb for some reason. I'm stumped.

        When people make you see red, be thankful your not colour blind.

        J 1 Reply Last reply
        0
        • J japel

          No Good It also fails if i put the absolute path "C:\Inetpub\wwwroot\ShowroomRegister\App_Data\ShowroomRegDB" Very Strange... I know the Connection string works but it keeps looking for dbo.mdb for some reason. I'm stumped.

          When people make you see red, be thankful your not colour blind.

          J Offline
          J Offline
          Jakob Farian Krarup
          wrote on last edited by
          #4

          Try altering your SQL commands from ("SELECT Important FROM dbo.ConfigTb WHERE ConfigID = 1") to: ("SELECT Important FROM ConfigTb WHERE ConfigID = 1") I think the "dbo" - may be confusing the Driver.

          Kind regards - Jakob :cool: ********************************************* Three kinds of people in the world: - Those who can count.. - Those who can't! 10 kinds of people in the world: - Those who understand binary - Those who don't

          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