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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. asp.net database connection error

asp.net database connection error

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netdatabasedesign
3 Posts 3 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.
  • G Offline
    G Offline
    gaurabmani
    wrote on last edited by
    #1

    I have problen connecting to the access database through asp.net, this is the page load code i have already set the connection strings through the design views... private void Page_Load(object sender, System.EventArgs e) { oleDbConnection1.Open(); oleDbDataAdapter1.SelectCommand.CommandText="select country from players"; dataReader=oleDbDataAdapter1.SelectCommand.Execute Reader(); while(dataReader.Read()) { nameList.Items.Add(dataReader.GetString(0)); oleDbConnection1.Close(); } } i got an error c:\inetpub\wwwroot\dropdown_database\WebForm1.aspx .cs(32): The name 'dataReader' does not exist in the class or namespace 'dropdown_database.WebForm1' c:\inetpub\wwwroot\dropdown_database\WebForm1.aspx .cs(33): The type or namespace name 'dataReader' could not be found (are you missing a using directive or an assembly reference?) what it means and how i can overcome this problem ??

    A A 2 Replies Last reply
    0
    • G gaurabmani

      I have problen connecting to the access database through asp.net, this is the page load code i have already set the connection strings through the design views... private void Page_Load(object sender, System.EventArgs e) { oleDbConnection1.Open(); oleDbDataAdapter1.SelectCommand.CommandText="select country from players"; dataReader=oleDbDataAdapter1.SelectCommand.Execute Reader(); while(dataReader.Read()) { nameList.Items.Add(dataReader.GetString(0)); oleDbConnection1.Close(); } } i got an error c:\inetpub\wwwroot\dropdown_database\WebForm1.aspx .cs(32): The name 'dataReader' does not exist in the class or namespace 'dropdown_database.WebForm1' c:\inetpub\wwwroot\dropdown_database\WebForm1.aspx .cs(33): The type or namespace name 'dataReader' could not be found (are you missing a using directive or an assembly reference?) what it means and how i can overcome this problem ??

      A Offline
      A Offline
      Anshuman Singh
      wrote on last edited by
      #2

      have you careted new object of datareader class ? if not then please first try it.

      Anshuman Singh [anshumas@rediffmail.com](mailto:Anshuman Singhanshumas@rediffmail.com)

      1 Reply Last reply
      0
      • G gaurabmani

        I have problen connecting to the access database through asp.net, this is the page load code i have already set the connection strings through the design views... private void Page_Load(object sender, System.EventArgs e) { oleDbConnection1.Open(); oleDbDataAdapter1.SelectCommand.CommandText="select country from players"; dataReader=oleDbDataAdapter1.SelectCommand.Execute Reader(); while(dataReader.Read()) { nameList.Items.Add(dataReader.GetString(0)); oleDbConnection1.Close(); } } i got an error c:\inetpub\wwwroot\dropdown_database\WebForm1.aspx .cs(32): The name 'dataReader' does not exist in the class or namespace 'dropdown_database.WebForm1' c:\inetpub\wwwroot\dropdown_database\WebForm1.aspx .cs(33): The type or namespace name 'dataReader' could not be found (are you missing a using directive or an assembly reference?) what it means and how i can overcome this problem ??

        A Offline
        A Offline
        arung_73
        wrote on last edited by
        #3

        Hi, The problem may be with var declaration. Use the following Declaration statement. OleDbDataReader DataReader=new OleDbDataReader ();

        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