SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 69 of 69
  1. #51
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dhtmlgod
    Here's an article I like to keep handy for that very question: http://aspnet.4guysfromrolla.com/articles/050405-1.aspx

    not sure what the date of the previous article in the above link is but the link below is a tutorial by the same author that creates a data access layer using typed datasets in asp.net 2.0.

    http://asp.net/learn/dataaccess/tuto....aspx?tabid=63

  2. #52
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Nashville, TN
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Say it ain't so!

    Quote Originally Posted by dsa1971 View Post
    not sure what the date of the previous article in the above link is but the link below is a tutorial by the same author that creates a data access layer using typed datasets in asp.net 2.0.

    http://asp.net/learn/dataaccess/tuto....aspx?tabid=63
    Yeah... All my asp.net 2.0 sites have been based on this asp.net tutorial by Scott Mitchell. In it, he uses Visual Studio to create a "DataSet" in the AppCode folder. It makes a neat GUI copy of the database as some sort of XML file thingy. I finally felt like I could face life after reading this tutorial.

    So... That's the wrong way to do it? Really? Aw, Crap...

  3. #53
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Typed datasets can generate method wrappers (table adapters) for SQL queries which can be used without using a dataset instance. If you are concerned about the performance of the dataset, but like the GUI approach (and the wizards to generate the SQL); then you can simply generate a typed dataset, generate table adapters for the tables, and simply use the latter in "direct mode", i.e. DataReaders.

  4. #54
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Nashville, TN
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I've been doing is using the GUI to make both the dataset and the table adapters, and using an ObjectDataSource to talk to the tableadapters. Then my controls are bound to the ObjectDataSource. I hope this means I am off the hook, and not breaking one of the thirty something commandments.

  5. #55
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that is perfectly ok. The objectdatasource separates the sql from the page; the sql goes into the table adapters. If you changed the database, you merely had to change the table adapter (hence the name). You are doing what most MS asp.net people demonstrates at conferences, in demos etc. It does provide a measure of de-coupling and it performs and scales as good as any hand-coded SQL.

    When VS2008 is released you can use LinqDataSource and a DataContext instead, and it will be almost plug-compatible with what you are doing; LinqDataSource can replace ObjectDataSource and the DataContext takes the place of the table adapters.

    Personally I'm looking forward to EDM, Entity Data Model which - sadly -- will not make it into VS2008.

  6. #56
    SitePoint Member
    Join Date
    May 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One question: how to connect SQL database with any project in ASP.NET?

  7. #57
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by Louis_34 View Post
    One question: how to connect SQL database with any project in ASP.NET?
    First use name space system.data.sqlclient

    then create connnection

    using

    sqlconnection conn = new sqlconnection('your connection string'
    then open this connection
    conn.open();


    Thanks for good question.

  8. #58
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow-- this is a very big thread. I wonder if it is actually useful to anyone. Speaking to the original topic of ".NET Best Practices", I have found David Hayden's http://www.pnpguidance.net site to be very useful for getting up to speed on newer .NET patterns such as ASP.NET MVC, DI, IoC and T4.
    in1.com | Bootply - Bootstrap playground

  9. #59
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    x. Don't use error handlanding inside asp net pages
    Rather use Page or application error event and redirect of the error type of page within web.config.
    y. Never leave the debug flag to true in web config when deploy
    z. If you use Ajax script manager add ScriptMode="Release" tag. That will srink the js file a lot and help with the speed (no debuging will be done)

  10. #60
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The tips I am going to demonstrate here is very useful and tested one. In order to save viewstate and speed up your web page performance to greater extend then always try to load data into control in Init event. We make a common mistake of loading data in dropdownlist,radiobuttonlist and checkboxlist in page_load event. In page_load event we tend to generate viewstate again and again even we support it with Ispostback constraint.

    So BEST practice to overcome the bandwidth leakage is to call data loading in dropdownlist control in init event of dropdown itself
    < aspropDownList ID="dll" OnInit="dll_Init" DataTextField="value"
    DataValueField="key" runat="server" ></aspropDownList>//

  11. #61
    SitePoint Member
    Join Date
    Jan 2010
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I fully agree with your last paragraph. Markup should speak for itself, otherwise you're mixing concerns... Perhaps that's why there's so little support for comments in web frameworks (in general). Who knows ;-)

  12. #62
    Pointiest Petitions carrotflowers's Avatar
    Join Date
    Jul 2003
    Location
    Suburbs of DC (MD)
    Posts
    595
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wonder if a discussion of avoiding Eval() belongs here. I've encountered a few Eval() naysayers and find the argument for avoiding it compelling (Eval() uses reflection, so especially when dealing with many, many records, using a typed expression instead is more efficient) - yet examples using DataBinder.Eval are pretty dominant.
    The guy is so tough I think his beard could beat up
    Nowitzki. -Gene Wojciechowski on Baron Davis |
    last.fm: lssian

  13. #63
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whats the recommended method opposed to datasets?

    great thread by the way covers so many points ive always thought am i doing this the right way or the wrong way

  14. #64
    SitePoint Member hemabasha's Avatar
    Join Date
    Oct 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can we get explanations with the rules

  15. #65
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    String concatenation is one of the commonly used operations among programmers. If you don't handle the string concatenation in .NET properly, it may decrease the performance of an application.

    basically concatenation string are 2 types:-

    * First, traditional way of using string and adding the new string to an existing string. In the .NET Framework, this operation is costly. When you add a string to an existing string, the Framework copies both the existing and new data to the memory, deletes the existing string, and reads data in a new string. This operation may be very resource consuming in lengthy string concatenation operations.

    * The second and better way to concatenate strings in .NET is using the StringBuilder class. The StringBuidler class provides the Append method, that inserts a new string to an existing string.

  16. #66
    SitePoint Member kners's Avatar
    Join Date
    Feb 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tyremt View Post
    whats the recommended method opposed to datasets?
    I guess a lot has changed in ASP.Net world since this thread started, but these days I would strongly press for Entity Framework as the big replacement for datasets (although in a way it probably is just another glorified dataset it self). I now use Entity Framework with repository in MVC and find this to work extremely well in my applications.

  17. #67
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For best .net pratices you must visit to w3school(dot)com. I learn all things regarding the asp.net from this website. In my opinion this one is the best resource for asp.net practices.

  18. #68
    SitePoint Member
    Join Date
    May 2012
    Location
    USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the string connection is more useable rather than StringBuilder because the string connection is very simple to fetch the data from the database by taking the string. So That is best resaurce.

  19. #69
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ASP.Net use too much data in VIEWSTATE which cause very big size pages. You can switch page based VIEWSTATE to session based VIEWSTATE to minimize page size


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •