Using c# in Code block
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-12-16 09:48 PM
I tried using c# in code block. It was working fine when i tried assigning simple string variables.
But when i try to create a Collection or a datatable and assign it to a variable I'm getting few errors such as
System.ComponentModel.MarshalByValueComponent is in a assembly that is not referenced.
System.ComponentModel.IListSource is in a assembly that is not referenced.
System.ComponentModel.ISupportIniatializeNotification is in a assembly that is not referenced.
Code Block
DataTable table = new DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Columns.Add("Drug", typeof(string));
table.Columns.Add("Patient", typeof(string));
table.Columns.Add("Date", typeof(DateTime));
table.Rows.Add(25, "Indocin", "David", DateTime.Now);
table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);
Output = table;
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-12-16 01:07 AM
You need to Add External Reference to the appropiate .NET dll, in your case is System.dll
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-12-16 11:14 AM
In this case if i add an external reference to mscorlib.dll, I'm getting a new error
""An assembly with the same identity exists. Try removing the duplicate reference"".
