.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Transferring of DataTable Vs its List for a WCF?

Posted By:      Posted Date: October 17, 2010    Points: 0   Category :WCF

I am trying to see if returning a DataTable containing 5000 records would be faster if I return instead a List<DataRow> collection from the WCF method. May be the List<DataRow> will have a smaller payload that that of original DataTable when sent via WCF ?



View Complete Post

More Related Resource Links

Returning a DataTable as List in WCF with WsHttpBinding

  • Would it be better in terms of payload, if I return a datatable as a List<DataRow> from a WCF method? I have WsHtppBinding for my WCF. I am expecting the datatable to contain 5,000 to 10,000 records.
  • Also, how can I test the difference in payload sizes when returning a DataTable Vs List<DataRow>?


Conversion of List to DataTable and ViceVersa


hi ,

           Iam having a requirement where I wil get datatable or Dataview from the DataAccessLayer I need to convert them into GanaricList of entites and ViceVersa from GenericList to Datatable or DataView.

             I tried it but I cant. Can anybody help me out.

who to load DataRow to DataTable



Who can I copy data from DataRow[] to DataTable....

DataRow[] TempDataRowFilter;



DataTable TempFilterTable = new DataTable();
TempFilterTable.LoadDataRow(TempDataRowFilter, true);

It is error why ?         

How to handle null while converting from my datatable to List<> using LINQ


I am converting my datatable to LISt using LINQ
how do I handle nulls coming from database

List<Port> portDetails = new List<Port>();
DataTable dt = ds.Tables[0];               
portDetails = (from q in dt.AsEnumerable()
select new Port
PortCode = q.Field<string>("Code"),
ExtCode = q.Field<string>("Nb"),
Name = q.Field<string>("Name"))

In the above query if Code is null I do not want property
portcode to be set to the value it should only set if it is
not null or not blank 
PortCode = q.Field<string>("Code"),

What should be syntax
I was trying somethign like this which doesnt work
Portcode = q.Field<bool>("Code") == null ? null : q.Field<bool>("Code")


How to generate List Menu form the DataTable

Hi all,This is my c# code.public partial class HorizontalCssMenu : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        if (!IsPostBack)        {            LoadMenu();        }    }    private void LoadMenu()    {        DataTable dtMenu = LoadData();        StringBuilder sb = new StringBuilder();        foreach (DataRow dr in dtMenu.Rows)        {            if (string.IsNullOrEmpty(Convert.ToString(dr["ParentID"]))                || Convert.ToString(dr["ParentID"]) == "0")            {                sb.AppendLine("<ul>");                sb.AppendLine("<li ID=\"" + Convert.ToString

Generic List to DataTable



I have a GenericList and i want to convert that to DataTable

My code is here

Dim queryF = From FinOpeningRegisterBranch In db1.FinOpeningRegisterBranches Where FinOpeningRegisterBranch.YearID = AccountLoginYearID.ToString And FinOpeningRegisterBranch.BranchCode = getBranchCode(txtBranch.Text, Me.Context) 
objFinOpRegs = CType(queryF.ToList(), List(Of FinOpeningRegisterBranch))

I am getting Count in "objFinOpRegs". But i want to convert "objFinOpRegs " to DataTable.


DataTable DataRow Value Assumed to be Number


My app reads in a .CSV file and parses it using the dAdapter.Fill(dTable) method.

This works fine and I can see the data in rows in the DataTable.

One of the fields in the .CSV file is "Customer Number".  When this value is put into the DataTable it is automatically added as a number type field.

When I try to read the DataRow value from that DataColumn I get an error because it is not a string type.


foreach (DataRow dr in myTable.Rows)






curItem.Item["CustNumber"] = <strong>dr["Customer Number"];</strong>





I have tried converting it to string and to int32 but nothing seems to work.

How do I convert it to a string?


wroking on datatable to fetch only distinct values of particular column to assign to dropdown list.


As I kept my fetched datatables into session and accessing it on another page there I am

wroking on datatable to fetch only distinct values of particular column to assign to dropdown list.

Ready made List Types provided by SharePoint

SharePoint provides some out of the box List Types. Some of the most used ready made list types that SharePoint provides currently are listed below:

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Dropdown list in ASP.NET - How to get value selected

am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

DataTable - Load from IDataReader - CreateDataReader - ReadXml WriteXml - Free ADO.NET Tutorials

The DataTable in ADO.NET 2.0 has been seriously beefed up and I absolutely love it. Not everything we consume deals with multiple resultsets and requires the ever popular DataSet. With the cool new features in the ADO.NET 2.0 DataTable, we can get many of the cool features in the DataSet without all the extra baggage and memory footprint particular to multiple resultsets.

Load DataTable from IDataReader

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend