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. Unable to save data on web

Unable to save data on web

Scheduled Pinned Locked Moved ASP.NET
helpdatabasesysadmin
2 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.
  • U Offline
    U Offline
    User 446798
    wrote on last edited by
    #1

    hi I have a web application hosted on web server and a database also on same server. But when i try to save data on the database, an error is displayed after some time that "The underlying connection was closed: Unable to connect to the remote server.". But i am using oledataadpater. so i don't need to open and close connection. . This same web application when run on local server gives no error. Please help me. shelly

    J 1 Reply Last reply
    0
    • U User 446798

      hi I have a web application hosted on web server and a database also on same server. But when i try to save data on the database, an error is displayed after some time that "The underlying connection was closed: Unable to connect to the remote server.". But i am using oledataadpater. so i don't need to open and close connection. . This same web application when run on local server gives no error. Please help me. shelly

      J Offline
      J Offline
      Javier Lozano
      wrote on last edited by
      #2

      Check your connection string. Make sure that you are connecting to the database. If you are using an OleDbCommand object, call the .Connection.Open() method on it. If you are just using a an SQL string, then you need to go through the DataAdapter to get the command object. See snippet below: OleDataAdapter myAdapter = new OleDbDataAdapter("SELECT * FROM TABLE", conn); myAdapter.SelectCommand.Connection.Open(); If the last line throws an exception, there's an error with your connection string. Or you don't have access to the SQL. ~Javier Lozano (blog)

      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