DataSource Controls :: Linq To SQL Set Linq Object Propertychanged?

Mar 12, 2010

I am writing a plugin to help with a current ERP system we have that I am not allowed to modify the data structure at all. The table I am dealing with has over 100 columns and I am wanting to set my linq object propertychanged event and submitchanges or do I really have list out each property and set it equal to the new one?Below is an example of what I am trying to do:

[Code]....

View 4 Replies


Similar Messages:

DataSource Controls :: LINQ To DataSet And LINQ To Object

Mar 9, 2010

txtLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Last_Name.ToString();

Like that I have large number of controls on my form. I have dought, if I assigned like this, db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Last_Name.ToString(); to every control, then I have set of controls like,

ddlSalutation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Salutation.ToString();
txtLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Last_Name.ToString();
txtFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).First_Name.ToString();
txtMI.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Middle_Initial.ToString();
txtAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Home_Address.ToString();
txtCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).City.ToString();
ddlState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).State.ToString();
txtZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Zip_Code.ToString();
txtSSNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ssn.ToString();
txtMRNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Mr_No.ToString();
txtDOB.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Birth_Date.ToString();
RBGender.SelectedItem.Value = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Gender.ToString();
RBMaritalStatus.SelectedItem.Value = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Marital_Status.ToString();
txtHomePhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Home_Phone.ToString();
txtWorkPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).WorkPhone.ToString();
txtCellPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).CellPhone.ToString();
ddlSuffix.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Suffix.ToString();
txtReligion.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Religion.ToString();
txtEmail.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Email.ToString();
txtSSOName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ssn.ToString();
txtPatientKin.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Patient_Kin.ToString();
txtRelationWithPatient.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Kin_Relation.ToString();
txtPhoneNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Kin_Phone.ToString();
ddlPreferredPharmacy.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Id_Pharmacy.ToString();
txtEmergencyContactName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Emergency_Contact_Name.ToString();
txtEmergencyContactNumber.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Emergency_Contact_Phone.ToString();
txtRelation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Kin_Relation.ToString();
txtRace.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Race.ToString();
ddlHowDidPatientFindUs.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).How_Found.ToString();
txtEmployerName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Name.ToString();
txtEmployerOccupation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Occupation.ToString();
txtEmployerPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Cell_Phone.ToString();
txtEmployerAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Address.ToString();
txtEmployerCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_City.ToString();
ddlEmployerState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_State.ToString();
txtEmployerZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Zip.ToString();
txtRecordsReleasedTo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Records_Released_To.ToString();
txtOtherInfo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Other_Info.ToString();
txtPopupNote.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Popup_e.ToString();
ddlPPlanName.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Insurance_Name.ToString();
txtPGroupNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Group_No.ToString();
txtPIDNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Id_No.ToString();
txtPPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Plan_Phone.ToString();
txtPVerifiedWith.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Verified_With.ToString();
txtPVerifiedPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Verified_Phone.ToString();
txtPEffectiveDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Effective_Date.ToString();
txtPExtDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Ext_Date.ToString();
if (db.usp_ATI_FetchPatientDetails(iPatientID).Count() > 0)
{
txtPGLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Name.ToString();
txtPGFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Name.ToString();
txtPGMI.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_MI.ToString();
txtPGBirthGDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Dob.ToString();
txtPGAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Address.ToString();
txtPGCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_City.ToString();
ddlPGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_State.ToString();
txtPGZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Zip.ToString();
txtPGEmployerFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Fname.ToString();
txtPGEmployerLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Lname.ToString();
txtPGEmployerPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Phone.ToString();
txtPGEmployerOccupation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Occupation.ToString();
txtPGEmployerAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Address.ToString();
txtPGEmployerCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_City.ToString();
ddlPGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_State.ToString();
txtPGEmployerZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Zip.ToString();
ddlPGPatientRelationshipToGuarantor.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Rel_With_Pat.ToString();
txtPGOtherInsuranceNotes.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Other_Notes.ToString();
txtPGAuthorization.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Authorization.ToString();
txtPGAob.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_AOB.ToString();
}
if (db.usp_ATI_FetchPatientDetails(iPatientID).Count() > 1)
{
txtSGLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Name.ToString();
txtSGFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Name.ToString();
txtSGMI.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_MI.ToString();
txtSGBirthGDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Dob.ToString();
txtSGAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Address.ToString();
txtSGCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_City.ToString();
ddlSGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_State.ToString();
txtSGZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Zip.ToString();
txtSGEmployerFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Fname.ToString();
txtSGEmployerLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Lname.ToString();
txtSGEmployerPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Phone.ToString();
txtSGEmployerOccupation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Occupation.ToString();
txtSGEmployerAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Address.ToString();
txtSGEmployerCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_City.ToString();
ddlSGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_State.ToString();
txtSGEmployerZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Zip.ToString();
ddlSGPatientRelationshipToGuarantor.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Rel_With_Pat.ToString();
txtSGOtherInsuranceNotes.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Other_Notes.ToString();
txtSGAuthorization.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Authorization.ToString();
txtSGAob.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_AOB.ToString();
}

My question is that, for each control the Stored Procedure called or not? If it is yes then it is time consuming and I need to use LINQ to DataSet or LINQ to Object rather than to call SP for each control. What is difference between LINQ to DataSet and LINQ to Object?

View 5 Replies

DataSource Controls :: Save Object With Linq?

Feb 5, 2010

I have a table into the database. Table name is NewResults. I have created instance of NewResult called result and fill it with all the infos i need. Now when I try to add i dont have add method in

context.NewResults. -> no Add here. So if i enter context.NewResults.Add(result) error as below is shown:

Error 1 'System.Data.Linq.Table<UDWAutoLinqTry.LinqToSql.NewResult>' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Data.Linq.Table<UDWAutoLinqTry.LinqToSql.NewResult>' could be found
(are you missing a using directive or an assembly reference?) C:Documents and SettingsAlek.NikolovskiMy DocumentsVisual Studio 2008ProjectsUDWAutoLinqTryUDWAutoLinqTryCompareCompareHelper.cs 332 32 UDWAutoLinqTry

what am i missing?

I know that i dont have to create add method myself i was googling and i am doing everything as it should but still no luck?

View 3 Replies

DataSource Controls :: Linq Object To GridView With Formatting?

Jan 21, 2010

I want to display a Gridview of Patients before I submit them to the database. Is there a way(better way), other then List<Patients>, to bind a list to a GridView.

I am using Linq to SQL and I have a DAL with the Patients table inside. I create a new list of Patients

[Code]....

Now the problem is I can't use a Linqdatasource or Objectdatasource to link to the GridView as no data is in the db yet. The only thing that works is GridView.DataSource = _patients; but I lose all automatic formatting and as far as I can tell it is going to be a pain to format manually. It would seem I should be able to somehow link my object _patients to an one of the datasourses so I would have formatting and all.

View 2 Replies

DataSource Controls :: How To Create It ,Object Data Source ,Linq And Sql Or Other Any Way?

Sep 20, 2010

my query is SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.CO
FROM V_HIERARCHY1 a

my data is ,HR HR Rec Records Leave Leave Records HRL.0001 Policy and Process for leave record. 27.06.2010 30.06.2010 WIP Edlink
HR HR Rec Records Leave Leave Records HRL.0002 Quarterly Review 01.07.2010 04.07.2010 Planned Edlink
HR HR DB Database SAL Salary DDS.0001 Calculation of Monthly salary 08.08.2010 09.08.2010 WIP Edlink
HR HR Rec Records Ind Induction Records HRI.0001 Completion of dossiers. 08.07.2010 10.07.2010 WIP Edlink
HR HR DB Database Emp Employee HDE.0001 Offer letter 06.07.2010 09.07.2010 WIP Edlink

my outout is ,HR

REC
LEAVE
HR1
REC1
LEAVE1

View 1 Replies

DataSource Controls :: Adding Attributes To A Linq Query Object?

Jan 11, 2010

Is it possible to add attributes in a linq query along with the other object data?

Here's what I have

[Code]....

But I'd like to add a custom attribute to each RadComboBoxItemData object in the query instead of having to do a foreach loop after the linq query to add the attributes on..

View 1 Replies

MVC 2 - Using LINQ And Sending A Linq Object To The View And Trying To Show It In A Textbox

Mar 11, 2011

I am using LINQ and sending a linq object to the view and trying to show it in a textbox like this

<%=Html.TextBox("petname",Model.PetName) %>

But I am getting error, how can I show (PetRecord.PetName) which is my linq entity

View 1 Replies

DataSource Controls :: Unable To Cast Object Of Type 'System.Data.Linq.DataQuery?

Mar 31, 2010

I wanted to delete the record from data but I receive this error "Unable to cast object of type 'System.Data.Linq.DataQuery`1[training_eval.Course]' to type 'training_eval.Course'.

Dim eval_sure = From ev In db.Evaluates Where ev.course_id = indexcourse Select ev.course_id
Dim del_course = From c In db.Courses Where c.Course_id = indexcourse
db.Courses.DeleteOnSubmit(del_course)
db.SubmitChanges()

View 4 Replies

DataSource Controls :: Compile In Order To Get The System.Linq.Dynamic Namespace / Dynamic Linq Error

Apr 20, 2010

I've added the Dynamic.cs file to my project and have set it's Build Action = Compile in order to get the System.Linq.Dynamic namespace.

However, when I try to use any of the new code I am getting an ambiguous call error; see below.

[Code]....

View 2 Replies

DataSource Controls :: LINQ To SQL: "An Object Specified For Refresh Is Not Recognized."

Jun 25, 2010

I am building an image gallery, and decided to try out LINQ to SQL in it. My problem is when I try and remove an image from the database, it gives me the error:

"An object specified for refresh is not recognized. Right before this, I call a stored procudure that removes the the row, then I tell the DataContext to refresh (Otherwise it seems that the changes never get applied).

Here the code:

[Code]....

The last line is where the error is thrown. I've tried removing the last two lines both one at a time and altogether, and the code executes without an error, but the changes never seem to be applied as subsequent SELECT statements return the deleted row.

The whole application has access to the same instance of the Shared DataContext.

View 1 Replies

Can Handle Null Value In Linq / Object Reference Not Set To An Instance Of An Object

May 10, 2010

[code]....

this code give that solution.but if any one of the field have null(example:r.urrQuickLinkRights contain the NULL) then only it will throw error like Object reference not set to an instance of an object.

View 2 Replies

DataSource Controls :: Using LINQ Datasource Control To SQL Databind

Feb 18, 2010

I have got an issue while using LINQ 2 SQL.

public IEnumerable<Customer> GetCustomers()
{
Table<Customer> custObject = context.Customers;
IEnumerable<Customer> filteredCustList = from customer in custObject
select customer;
filteredCustList;
}
GridView2.DataSource = utilLinqClass.GetCustomers();
GridView2.DataBind();

(no errors at build time or at compile time) Error I am getting is: An attempt to attach an auto-named database for file App_Dataaspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

View 1 Replies

C# - Linq To SQL Where In Clause Causes Object Not Set To Instance Of Object

Jul 1, 2010

I have two tables, subscriptions and topics. Each subscription is related to a specific TopicID (PK for topics table). The first query works fine and retrieves the topicID's of all videos that were uploaded today. The problem occurs when I try and then use the results of query1 as a where-in clause for query 2. I keep receiving object reference not set to instance of an object.

Query 1 IQueryable<int> topics = (from t in dataLayer.Videos
where SqlMethods.DateDiffDay(t.DateCreated, DateTime.Today) == 0
select t.TopicID).Distinct(); [code]....

I have looked at some samples around the net and they all seem to be identical to mine.

View 1 Replies

DataSource Controls :: How To Convert To Linq (vb.net)

Sep 16, 2010

I have an sql statement I want to convert to LINQ (VB.Net).

View 2 Replies

DataSource Controls :: Linq Distinct Ip According To Day?

May 4, 2010

I'm trying the pull out a result that shows me how many visitors I have had each day.

My database looks like this.

[code]....

View 5 Replies

DataSource Controls :: Linq - Next Withing Do While?

Jan 14, 2010

I am trying to use a linq query to create a report and I am unclear on how to traverse the linq dataquery in my case. Inside my for each loop, i have a do while loop. The way it is written below, the do while loop is infinite because I never skip to the next itm in oneSchedule. Placing a Next inside the do while loop causes a syntax error. So what is the correct method for moving to the next itm within the loop?????

[Code]....

[Code]....

View 3 Replies

DataSource Controls :: Query Using Linq To Sql?

Jun 25, 2010

I´m using Linq to Sql in my asp.net application, but the problem is:I have a query like this:

[Code]....

My query is not returning anything, how do I do to get this?my problem is with this interval I need to have.

View 2 Replies

DataSource Controls :: How To Do In Linq To Entity

Feb 2, 2010

select * from MyTable select "MonthName"= case when datepart(month,date1) =1 then 'January' when datepart(month,date1) =2 then 'February' end , count(*) as CountByMonth from venkat group by datepart(month,date1)

View 1 Replies

DataSource Controls :: Keyword In Linq To SQL?

Feb 1, 2010

I'm trying to "move" a LinqDataSource control to code behind to better control the query parameters. Problem I'm having is how does the "It" keyword translate to Linq To SQL syntax (not sure if I'm getting the terminology right here, but I think you get my meaning).

Control Markup:

[Code]....

Query:

[Code]....

View 3 Replies

DataSource Controls :: Linq Between Two Dates (VB)?

Jan 18, 2010

I am wanting to write this in linq SELECT *FROM Store_InformationWHERE Date BETWEEN '12/03/2007' AND '01/04/2008'Can anyone give me an example?

View 1 Replies

DataSource Controls :: Linq To XML - Get The Next Record?

Jan 28, 2010

I have the following xml:

[Code]....

If I have an ID, I would like to retrieve the next item that also has the same category as the item ID I have. So, for example, if I have ID=2, I would like to return the item with ID=4 (as item ID=3 has a different category).

View 2 Replies

DataSource Controls :: Compromising With A DBA On Linq To SQL?

Apr 7, 2010

Whenever you want to implement Linq to SQL on a project there is inevitably a battle between the DBA and the developers over it.

From the developer standpoint, Linq to SQL eliminates the need to manually write stored procs, ADO.NET data access classes, business object classes, and datatable -> business object conversion classes. This makes development a breeze and eliminates a lot of the traditional layers that you'd normally have to code.

Alternately, from a DBA perspective there are some issues. One is that a lot of DBA's like to do security at the sproc level, and this level would be gone. Another issue is that if the DBA wanted to mimic some sql functionality that the application is doing, possibly for a scripted action, they wouldn't be able to simply call the sproc that the application is using. Also they wouldn't be able to tell which columns are actively being used and which are not, as it'd be C# code specifying which columns are returned rather than sprocs. Lastly, if something needed to be changed structurally, it'd require a recompile and redeploy of the entire app rather than a simple sql script of 2 being deployed.

There are valid points on both ends, so I'm wondering what experiences you all have with this and what sort of compromises you made. In my situation, I'm the developer and I'm trying to figure out a compromise I can make with the DBA so we both give a little rather than one of us having to completely bend over. The obvious compromise to me is using sprocs from within Linq to SQL, but it adds another layer of development and the sprocs have to coded a certain way to play nice with Linq to SQL.

View 7 Replies

DataSource Controls :: LINQ To Entity Getting The First Row?

Jan 14, 2010

I am using the following LINQ to entity to get data from my db.

It should return only one row. So i want to be able to get the first row in the set and not have to go through a foreach.

I would also like to check and make sure it is only returning one row, if it returns multiple i need to throw an exception

[Code]....

View 1 Replies

DataSource Controls :: Convert SQL To Linq?

Jun 24, 2010

SELECT *
FROM dc.accounts t1
INNER JOIN dc.profiles t2 ON t1.AccountID = t2.AccountID
WHERE EXISTS
(
SELECT *
FROM dc.profileblocks t3
WHERE t3.AccountID = '14' and t1.AccountID = t3.AccountID
)

View 3 Replies

DataSource Controls :: LINQ To SQL - Foreach - To CSV?

Jun 11, 2010

I'm close to the solution I see where I am going wrong just unsure how to approach it. I want to be able to take a tables worth of data (via DataClasses) and put it in a CSV to download.

A LINQ to SQL query is performed (basically a 'Select All' from tbl_Newsletter), takes those results and the idea is to feed those results, one by one through the foreach which, inside it, is the CSV's definition e.g. List.Add(etc) as you'll see. After which the CSVExporter method is called - which works, as I can Download it, it just wont display any results.

C#: [Code]....

To which I get: Compiler Error Message: CS1729: 'Newsletter' does not contain a constructor that takes '2' arguments

with Newsletter obj = Newsletter.GetAll(); in place of Newsletter obj = new Newsletter();

I get: Compiler Error Message: CS0029: Cannot implicitly convert type 'System.Collections.Generic.List<Newsletter>' to 'Newsletter'

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved