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. General Programming
  3. C#
  4. DataRow inaccessible...

DataRow inaccessible...

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
6 Posts 5 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.
  • R Offline
    R Offline
    reshsilk
    wrote on last edited by
    #1

    Hello, I am writing a windows form app using c#. I would like to create a new data row in a regular c# class using the following code. public void addWell() { DataRow row = new DataRow(); } But I keep getting this error: "'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level" Does anybody know how to change the protection level of the DataRow? thanks! rc

    W M 2 Replies Last reply
    0
    • R reshsilk

      Hello, I am writing a windows form app using c#. I would like to create a new data row in a regular c# class using the following code. public void addWell() { DataRow row = new DataRow(); } But I keep getting this error: "'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level" Does anybody know how to change the protection level of the DataRow? thanks! rc

      W Offline
      W Offline
      Wjousts
      wrote on last edited by
      #2

      You can't instatiate a new DataRow object like that, it's constructor is protected and you can't do anything about that. If you want a new DataRow you must use your DataTable.NewRow() method which will return a new row that has been initalized with your tables schema (i.e. all the columns have been added).

      R U 2 Replies Last reply
      0
      • W Wjousts

        You can't instatiate a new DataRow object like that, it's constructor is protected and you can't do anything about that. If you want a new DataRow you must use your DataTable.NewRow() method which will return a new row that has been initalized with your tables schema (i.e. all the columns have been added).

        R Offline
        R Offline
        reshsilk
        wrote on last edited by
        #3

        that worked. thank you!!!

        1 Reply Last reply
        0
        • R reshsilk

          Hello, I am writing a windows form app using c#. I would like to create a new data row in a regular c# class using the following code. public void addWell() { DataRow row = new DataRow(); } But I keep getting this error: "'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level" Does anybody know how to change the protection level of the DataRow? thanks! rc

          M Offline
          M Offline
          mohammed syam
          wrote on last edited by
          #4

          The solution of this problem is to use : DataTable dt = new DataTable(); DataRow dr = dt.NewRow();

          U 1 Reply Last reply
          0
          • M mohammed syam

            The solution of this problem is to use : DataTable dt = new DataTable(); DataRow dr = dt.NewRow();

            U Offline
            U Offline
            User 4653952
            wrote on last edited by
            #5

            Good Lord!

            1 Reply Last reply
            0
            • W Wjousts

              You can't instatiate a new DataRow object like that, it's constructor is protected and you can't do anything about that. If you want a new DataRow you must use your DataTable.NewRow() method which will return a new row that has been initalized with your tables schema (i.e. all the columns have been added).

              U Offline
              U Offline
              User 10192306
              wrote on last edited by
              #6

              i am using it in the webpage is that ok can you please suggest me as soon as possible

              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