manjula d

manjula d

  • NA
  • 172
  • 139.9k

how to convert sql of this query to LINQ

Sep 24 2013 3:11 AM
"select file_name from bp_vendor_doc_details where upload_id=(select upload_id from bp_vendor_upload_doc where bid_id=@bidid and vendor_id=@vendorid)";

i need to write LINQ of this Query 


i wrote like this:
var vendocdetails = (from VDD in objbidportalEntity.bp_vendor_doc_details join UD in objbidportalEntity.bp_vendor_upload_doc on VDD.Upload_Id equals UD.Upload_Id where UD.Bid_Id == paramBidId && UD.Vendor_Id == paramVendorId select new { UD.upload_id , VDD.file_name});
DataTable dt = new DataTable();
                     dt.Columns.Add("path", typeof(string));
                     DataRow dr;
                     List<string> lstFiles = vendocdetails.ToList<string>();
                    foreach (string vendor in lstFiles )
                    {
                        dr = dt.NewRow();
                        dr[0] = lstFiles ;
                        dt.Rows.Add(dr);
                    }



i got error to red mark of Anonymous Types

Answers (2)