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. Database & SysAdmin
  3. Database
  4. Sqlconnection

Sqlconnection

Scheduled Pinned Locked Moved Database
databasehelpcsharpasp-networkspace
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.
  • M Offline
    M Offline
    Member 12287337
    wrote on last edited by
    #1

    Hi all.am really new to asp.net,c# as well as sql.i hope you will help me on this.
    i want to call my stored procedure from my class file. and later create an instance of the class in the .aspx.cs file.to do this i have to create a connection object and pass in my configuration key from web.config. that is where am stuck because i had used this:
    SqlConnection connection = new SqlConnection ( ConfigurationManager.ConnectionStrings [‘’B.F.M.S”].ConnectionString);
    B.F.M.S is my sql database.
    Now when i run my application its giving a [NullReference Exception: Object reference not set to an instance of an object].
    the error is with that line.
    Can you please help on how i can rectify that.

    Richard DeemingR 1 Reply Last reply
    0
    • M Member 12287337

      Hi all.am really new to asp.net,c# as well as sql.i hope you will help me on this.
      i want to call my stored procedure from my class file. and later create an instance of the class in the .aspx.cs file.to do this i have to create a connection object and pass in my configuration key from web.config. that is where am stuck because i had used this:
      SqlConnection connection = new SqlConnection ( ConfigurationManager.ConnectionStrings [‘’B.F.M.S”].ConnectionString);
      B.F.M.S is my sql database.
      Now when i run my application its giving a [NullReference Exception: Object reference not set to an instance of an object].
      the error is with that line.
      Can you please help on how i can rectify that.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You have already posted this in the ASP.NET forum. Posting the same question in multiple forums duplicates work and annoys people.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      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