DataSource Controls :: Cross Server LINQ Associations?
Jan 28, 2010
I have some structured objects that map to multiple DB tables that I have created using LINQ using [Association(Name=, Storage=, ThisKey=, OtherKey=)] links to the objects attached to other tables. If I try to create an association to an object attached to a table on another database server, will this throw an error/go horribly wrong (I'm guessing yes)? If this _is_ possible, are there any issues I need to be aware of?
With the gridview I can create a template field to query across associations but I don't see how its possible to do that with the listview (?). I tried to create associations in the eval fields
(ie productId.Brand) where productId is in the Reviews table and is associated with the Products table - and Brand is a member of the Product table but it was no go?
Now I'm developing web application with ASP.Net MVC but I have to use 3 databases. So I have no idea about this. I have to extract the data from 2 databases and I have to save the data to another 3rd database.
I am working on an Entertainment Website, my client wants to save videos in the database, i am a bit aware of silverlight, that it can be done through microsoft's silverlight platform.
how to accomplish my goal, i am using ASP.Net with C# and LINQ and backend in MS-SQL Server 2008.
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:
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,
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?
In Sql Server, there's a Row_Number and now I want to do the same thing with LinQ when I get data from a table and I want to create a new row like Row Number.
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.
All my pages are receiving this error - website is down; here's the code:
[Code]....
Except my web config file shows linq is accounted for? [Code]....
I would note that I updated to VWD Express 2010 then had to revert back to 3.5 because my host at Arvixe had not updated my server yet. He then said he updated it and I reverted up to 4.0 again. It turned out he hadn't and I tried to revert back...and then this showed up and numerous other errors.
TABLE 1 SELECT I.STUNA ,S.SNO ,SUM(B.AMT * Y.YEAR) AS AMT FROM STUDENT S LEFT JOIN INFO I ON S.SNO = I.SNO LEFT JOIN BONUS B ON S.SNO = B.SSNO LEFT JOIN YEAR Y ON S.SNO = Y.SSNO STUNA SNO AMT JOHN A 10 LISA B 20 ALLEN C 100
TABLE 2 SNO AMT A 1 B 2 C 3 D 5
I WANT TO HAVE RESULT LIKE THIS (TABLE1 + TABLE2)
STUNA SNO AMT JOHN A 11 LISA B 22 ALLEN C 103 EDDIE D 5
I TRIED USE THIS QEURY
SELECT I.STUNA ,S.SNO ,SUM(B.AMT) AS AMT FROM STUDENT S LEFT JOIN INFO I ON S.SNO = I.SNO LEFT JOIN BONUS B ON S.SNO = B.SSNO LEFT JOIN ( SELECT SNO, SUM(AMT) AS AMT FROM TABLE2 GROUP BY SNO ) T2 ON S.SNO = T2.SNO GROUP BY I.STUNA,S.SNO THE RESULT IS STUNA SNO AMT JOHN A 11 LISA B 22 ALLEN C 103
THE "EDDIE" WAS MISS. ALSO I TRY USE CROSS JOIN... THE RESULT IS STILL NOT CORRECT.
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?????
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)
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).
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).
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.
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 )