Compiler error message: CS0122: "System. Data. DataRow. DataRow (System. Data. DataRowBuilder)" is not accessible because it is restricted by the protection level and restricted by the protection level.
Compilation Error Note:An error occurs during compilation of resources required to provide services to this request. Check the following error details and modify the source code as appropriate.
Compiler error message:CS0122: "System. Data. DataRow. DataRow (System. Data. DataRowBuilder)" is not accessible because it is protected
Source error:
|
Row 17: Row 18: DataTable dt = new DataTable (); row 19: System. data. dataRow r = new DataRow (); Row 20: // DataRow r = new DataRow (); row 21: DataColumn c = new DataColumn (); |
Source file:D: \ My Documents ents \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs
Row:19
Show detailed compiler output:
C: \ Program Files \ Microsoft Visual Studio 9.0 \ Common7 \ IDE> "C: \ WINDOWS \ Microsoft. NET \ Framework \ v3.5 \ csc.exe "/t: library/utf8output/R:" C: \ WINDOWS \ assembly \ GAC_32 \ System. web \ 2.0.0.0 _ b03f5f7f11d50a3a \ System. web. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. xml \ 2.0.0.0 _ b77a5c561934e089 \ System. xml. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. data. dataSetExtensions \ 3.5.0.0 _ b77a5c561934e089 \ System. data. DataSetExtensions. dll "/R:" C: \ WINDOWS \ assembly \ GAC_32 \ System. enterpriseServices \ 2.0.0.0 _ b03f5f7f11d50a3a \ System. enterpriseServices. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. workflowServices \ 3.5.0.0 _ 31bf3856ad364e35 \ System. workflowServices. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. core \ 3.5.0.0 _ b77a5c561934e089 \ System. core. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. drawing \ 2.0.0.0 _ b03f5 F7f11d50a3a \ System. drawing. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. web. extensions \ 3.5.0.0 _ 31bf3856ad364e35 \ System. web. extensions. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. web. services \ 2.0.0.0 _ b03f5f7f11d50a3a \ System. web. services. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System \ 2.0.0.0 _ b77a5c561934e089 \ System. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. runtime. serialization \ 3.0.0.0 _ b77a5c5 61934e089 \ System. runtime. serialization. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. configuration \ 2.0.0.0 _ b03f5f7f11d50a3a \ System. configuration. dll "/R:" C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ mscorlib. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. identityModel \ 3.0.0.0 _ b77a5c561934e089 \ System. identityModel. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. serviceModel \ 3.0.0.0 _ b77a5c561934e089 \ S Ystem. serviceModel. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. web. mobile \ 2.0.0.0 _ b03f5f7f11d50a3a \ System. web. mobile. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. xml. linq \ 3.5.0.0 _ b77a5c561934e089 \ System. xml. linq. dll "/R:" C: \ WINDOWS \ assembly \ GAC_32 \ System. data \ 2.0.0.0 _ b77a5c561934e089 \ System. data. dll "/R:" C: \ WINDOWS \ assembly \ GAC_MSIL \ System. serviceModel. web \ 3.5.0.0 _ 31bf3856ad364e35 \ System. serv IceModel. web. dll "/out:" C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ Temporary ASP. NET Files \ test_wz \ 537e400f \ ef20f76 \ App_Web_bvqv1ywx.dll "/debug-/optimize +/w: 4/nowarn: 1659; 1699; 1701/warnaserror-" C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ Temporary ASP. NET Files \ test_wz \ 537e400f \ ef20f76 \ App_Web_bvqv1ywx.0.cs "" C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ Temporary ASP. NET Files \ test_wz \ 537e400f \ ef20f76 \ App_Web_bvqv1ywx.1.cs "C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ Temporary ASP. NET Files \ test_wz \ 537e400f \ ef20f76 \ App_Web_bvqv1ywx.2.cs "applies to Microsoft (R ). NET Framework Version 3.5 Microsoft (R) Visual C #2008 compiler 3.5.30729.1 copyright (C) Microsoft Corporation. All rights reserved. D: \ My Documents files \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs (19,33): error CS0122: "System. data. dataRow. dataRow (System. data. dataRowBuilder) "inaccessible because it is subject to protection level restrictions c: \ WINDOWS \ assembly \ GAC_32 \ System. data \ 2.0.0.0 _ b77a5c561934e089 \ System. data. dll: (location related to the previous error) d: \ My Documents ents \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs (): error CS0144: the abstract class or interface "System. array "instance d: \ My Documents ents \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs (22, 37): error CS0117: "System. array does not contain the definition d: \ My Documents ents \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs (22, 41): error CS0117: "System. array does not contain the definition d: \ My Documents ents \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs (22, 45): error CS0117: "System. array does not contain the definition d: \ My Documents ents \ Visual Studio 2008 \ WebSites \ test_wz \ Default. aspx. cs (22, 49): error CS0117: "System. array does not contain the definition of "Add" |
Version:Microsoft. NET Framework Version: 2.0.50727.3655; ASP. NET version: 2.0.50727.3658
Solution:
DataRow cannot be new directly
You should call the NewRow () method of DataTable to create a new row.
DataRow r = dt. NewRow ();
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.