473,794 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

linq and asp.net

I am starting a new web application and I was planning on using linq but i
have a bunch of problems.
most forms will display some data from the database, but there always has to
be a filtering support - you need to be able to filter the data based on one
or more columns (I make the filter in runtime). The data also has to be paged
(with user selected sort column).

First I wanted to use the LinqDataSource for this, but it does not have a
Refresh method and filtering via parameters from controls doesnt work. I
tried then making my own linq query and binding listview on it, but then
datapager doesnt work properly (that is, it doesnt work at all).

so please help, should i go back to the datasets which require a lot more
work, or is there a way to make use of the linq queries - i need to be able
to make pager work (or some other way to display page numbers and them to be
working links) and to be able to have more fields for filtering?
pls help

thanx in advance,
Nedim
Jan 3 '08 #1
6 1510
"Nedim" <Ne***@discussi ons.microsoft.c omwrote in message
news:57******** *************** ***********@mic rosoft.com...
so please help, should i go back to the datasets which require a lot more
work, or is there a way to make use of the linq queries - i need to be
able
to make pager work (or some other way to display page numbers and them to
be
working links) and to be able to have more fields for filtering?
I think the debate on Linq is likely to become almost as heated as the C# vs
VB.NET debate we started back in 2002 which, thankfully, has pretty much
gone away now...

My personal opinion (so far) is that Linq is superb at allowing .NET objects
to be queried using SQL syntax *as if* they were data tables, but I haven't
really found any need to use Linq to query an actual database... That's
almost certainly because I never go anywhere near the SqlDataSource /
AccessDataSourc e etc objects - instead, I have a standard DAL which I use
for all database work so, once the connection string is in place, any
individual query is usually just one line of C# code...

There's an interesting take on this here:
http://blogs.msdn.com/ploeh/archive/...Practices.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 3 '08 #2
well my biggest problem is paging (with filtering) and i've always had
trouble doing that. linq seemed like a good solution for that, but there is
just too many unfinished (or maybe things I havent found out yet) to make it
useful for everything - again, i think that filtering and refresh method on
linqdatasource are pretty basic things.
and now with so many new things in .net 3.5 and new project, i want to use
all the benefits of a new enviroment that i can, so I'm still not sure what
to do and how to do it - separate dal project, should the dal use datasets,
linq or both, and what is the best way to do paging - pager control seemed
godsend, but it doesnt work with anything other then linqdatasource.

"Mark Rae [MVP]" wrote:
"Nedim" <Ne***@discussi ons.microsoft.c omwrote in message
news:57******** *************** ***********@mic rosoft.com...
so please help, should i go back to the datasets which require a lot more
work, or is there a way to make use of the linq queries - i need to be
able
to make pager work (or some other way to display page numbers and them to
be
working links) and to be able to have more fields for filtering?

I think the debate on Linq is likely to become almost as heated as the C# vs
VB.NET debate we started back in 2002 which, thankfully, has pretty much
gone away now...

My personal opinion (so far) is that Linq is superb at allowing .NET objects
to be queried using SQL syntax *as if* they were data tables, but I haven't
really found any need to use Linq to query an actual database... That's
almost certainly because I never go anywhere near the SqlDataSource /
AccessDataSourc e etc objects - instead, I have a standard DAL which I use
for all database work so, once the connection string is in place, any
individual query is usually just one line of C# code...

There's an interesting take on this here:
http://blogs.msdn.com/ploeh/archive/...Practices.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 3 '08 #3
One of the major challenges in asp.net is to keep your lane straight without
making unnecessary turns.

I have an impression that many asp.net innovations target novice developers
or those who switch over from some other technologies. Developers who have
already made their way and style through the years of practical development,
who already know sql, javascript and all sorts of big and little things,
don't need to rush to switch the paradigm of managing everything in
server-side code modules.

In many cases it is better to use natural database queries without
introducing an extra complexity layer and having to pass through yet another
learning curve.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:ug******** ******@TK2MSFTN GP04.phx.gbl...
"Nedim" <Ne***@discussi ons.microsoft.c omwrote in message
news:57******** *************** ***********@mic rosoft.com...
>so please help, should i go back to the datasets which require a lot more
work, or is there a way to make use of the linq queries - i need to be
able
to make pager work (or some other way to display page numbers and them to
be
working links) and to be able to have more fields for filtering?

I think the debate on Linq is likely to become almost as heated as the C#
vs VB.NET debate we started back in 2002 which, thankfully, has pretty
much gone away now...

My personal opinion (so far) is that Linq is superb at allowing .NET
objects to be queried using SQL syntax *as if* they were data tables, but
I haven't really found any need to use Linq to query an actual database...
That's almost certainly because I never go anywhere near the SqlDataSource
/ AccessDataSourc e etc objects - instead, I have a standard DAL which I
use for all database work so, once the connection string is in place, any
individual query is usually just one line of C# code...

There's an interesting take on this here:
http://blogs.msdn.com/ploeh/archive/...Practices.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 3 '08 #4
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..

I couldn't agree more.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 3 '08 #5
Yup. LINQ is great, LINQ is cool. To write apps with LINQ, you gotta take
time for LINQ school. (boy, that was profound, huh...)
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Mark Rae [MVP]" wrote:
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..

I couldn't agree more.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 3 '08 #6
"Peter Bromberg [C# MVP]" <pb*******@yaho o.NoSpamMaam.co mwrote in message
news:BB******** *************** ***********@mic rosoft.com...
Yup. LINQ is great, LINQ is cool. To write apps with LINQ, you gotta take
time for LINQ school. (boy, that was profound, huh...)
Nah - if you'd wanted to be really cool, you'd have rhymed Bromberg with
homburg... ;-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 3 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1896
by: Dave Johnson | last post by:
Greetings, i want to be able to use linq new technology with sql server. the senario i am not able to do so far is as follow: 1- i program with linq 2- be able to generate and manipulate xml files 3- all this xml files are stored in Sqlserver
4
2162
by: cj | last post by:
Can I use LINQ in VB .Net 2008 to get to a Visual FoxPro Table? I've seen demos of it with SQL Server but they've used it with a server browser and I don't think that'd work when I need to see VFP tables.
9
2505
by: =?Utf-8?B?cmF1bGF2aQ==?= | last post by:
Hi all: after reading different places/sites about linq... I ran into these questions: 1. What framework do we need to run linq ? (does it depend on what version of visual studio we have?) how about vs2008? is it different name space or framework for linq xml or linq sql? ( 2. do we need to have references to what linq's dlls. or namespaces? system core? 3. what name spaces are needed?
0
2365
by: =?Utf-8?B?SHlwZXJjb2Rlcg==?= | last post by:
I'm encountering some strange behavior after deploying a ASP.net 3.5 website to production, i'm unable to reproduce these in my dev environment. This error seems to occur very randomly but it's occuring enough to be a real cause for concern. The errors occur a couple times a week and the website is hit with constant traffic 24x7. Below are the two errors that are encountered. I had read something about MARS causing errors like this but...
4
2189
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and not reinsert it with a different revision number. Compounding the issue, we’ve also got an associated table storing properties for our entities which is not revisioned, but we still want changes to the children of our entity (additions, changes...
14
3691
by: thj | last post by:
Hi, I was wondering what you guys are using and why? LINQ to SQL or NHibernate? Thanks in advance, Tommy
9
2263
by: Cirene | last post by:
I'm about to begin a brand new, big, ASP.NET project (using 3.5 .net fw), VS 2008. I'm using MySQL as the backend (customer request.) I have absolutely no experience with LINQ and/or the Entity Framework. Though I am quite comfortable with ADO.NET and VB.NET. In your opinion, should I take a few days and learn it and utilize these technologies in this new project (I'm starting from scratch)? Are the benefits worth it in your opinion?...
3
12437
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ====================== Message: Specified cast is not valid. Type: System.InvalidCastException Source: System.Data.Linq TargetSite: Boolean TryCreateKeyFromValues(System.Object, V ByRef)
4
2533
by: George | last post by:
I am a bit conservative type and usually give some time for technology to mature before starting to try it. Today my question is Linq. To start using it or not. So here is the voting questions. 1. It speeds up development. Yes or No? 2. It makes programs easier to code and read. Yes or No? 3. Perfomance is the same (or comparable) comparing Linq with MsSql and ADO.NET
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.