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


Similar Messages:

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

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 :: 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 :: 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

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 :: 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

DataSource Controls :: Linq With Where Like '%' + Input '%'?

Feb 28, 2010

I try to implement a very simple search but my LINQ and MVC passing of parameter skills are not existing yet.

In SQL I want to do SELECT ItemName, ItemDescription FROM ahn_search WHERE ItemDeschription LIKE '%'+@input+'%'.

Could someone please help me to get any closer ?

[Code]....

View 7 Replies

DataSource Controls :: Linq To SQL Vs ADO.NET Dataset ?

Jun 12, 2010

What are the advantages and disadvantages of linq to sql and ado.net dataset?

Which method should I use to connect, retrive, update and generally operate on data from a ME SQL database?

View 1 Replies

DataSource Controls :: Set Value In Textbox Using Linq To SQL?

Jun 24, 2010

I am trying to set value to Textbox from the query Linq to SQL , I can fill the gridview , and I can only set FirstOrDefault to textbox

what I need to count the record of my table then add the field emailaddress to textbox1 and then add ";" and then go to next record , it was vert easy using reader , but in LINQ is very hard

my code is

[Code]....

the result in textbox must be like follow:

test@ff.com ;
test@hotmail.com and so on.

View 13 Replies

DataSource Controls :: Implications Of LINQ To SQL

Mar 12, 2010

I thought I'd read that LINQ to SQL performs operations on the user's behalf and acts pretty much in the same way as if you manually queried a database. I was told today that it can be considerably slower.Can anyone point me to a link or share their knowledge so I can help to build up a picture of what actually happens?

View 4 Replies

DataSource Controls :: Count A Row Using LINQ To SQL?

Jun 14, 2010

im trying to count the amount of users inside a chatroom, im trying to count a specific row using LINQ to SQL.

Heres the code

DataRowView dataRow = ((DataRowView)e.Item.DataItem);
string roomId = dataRow["RoomID"].ToString();
ChatRoomDataContext db = new ChatRoomDataContext();
var query = from c in db.ChatLoggedInUsers
where c.RoomID.ToString() == roomId.ToString()
select new { };
foreach (var c in query)
{
}

Where " select new { }; " is, is left blank as i am not too sure what goes there. I tried adding c.UserName.Count() but i got an error. what i need to put into that space to count the amount of records in the UserName column?

View 3 Replies

DataSource Controls :: Using Linq For Treeview?

Jul 12, 2010

I have the following SQL Tables:

[Code]....

I'd like to use bind these tables to the treeview using Linq as I read somewhere it is the fastest way to bind the TreeView control.

This TreeView control is based on the Client dropdown list, once a user selects the client, the TreeView is populated accordingly.

how can I accomplish this task. Currently I am using Stored procedures to bind the treeview.

View 2 Replies

DataSource Controls :: Use LINQ To Get Day With Most Orders?

Apr 28, 2010

I'm trying to display the day most orders were placed, and how many orders were placed.

I use the following LINQ to get find what I'm looking for:

[Code]....

I want to display this as follow:

12 orders were placed 01.01.2010.

I get the ordercount using this:

[Code]....

But how can i get the day?

var topDay = from o in orders

View 9 Replies

DataSource Controls :: How To Get Data From Two Tables In Linq

Apr 28, 2010

How to get data from two tables through linq .1 ) productsDetails 2) productsImages to bind further listview.

View 1 Replies

DataSource Controls :: One Linq Query With Two Db Connection?

May 31, 2010

I want to use from two db connection in one linq query

My sample is:

int a=1;
if(a==1)
DataClasses1DataContext1 db = new DataClasses1DataContext1();
else
DataClasses1DataContext2 db = new DataClasses1DataContext2();
var q =
from c
in db.F_Groups
select c;

In this code a=1 so db connection is DataClasses1DataContext1

I want if a=2 then db connection = DataClasses1DataContext2

but this code is error.

db connections is completely same but in two deferent class a db connection is sql and another is oracle

View 4 Replies







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