Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Layered web project with ASP.NET

Layered web project with ASP.NET

Scheduled Pinned Locked Moved ASP.NET
csscsharpasp-netdatabasedesign
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrkeivan
    wrote on last edited by
    #1

    Hey guys, I have searched about this on the new and here but I'm still confused, so I'm gonna lay out this and hopefully with your help I can get it over with. I'm trying to design and implement a 3 layer web application, I want to fetch the info(fields such as name, email, ... ) for a student from Student table in my database: (consequently I want to do update, delete and insert as well) In my DAL class I fetch the record from database and return a dataset: public DataSetFetchProfile(string UserName) { DataSet ThisDataSet = new DataSet(); ThisAd.SelectCommand = new SqlCommand("Profile_FetchStudentInfo", ThisConnection); ThisAd.SelectCommand.CommandType = CommandType.StoredProcedure; ThisAd.SelectCommand.Parameters.Add("@UserName", SqlDbType.NVarChar, 256).Value = UserName; ThisAd.Fill(ThisDataSet, "StudentT"); return ThisDataSet; } and I have this function in my BLL class calling this one: public DataSet ReturnProfileInfo(string UserName) { return ThisStudent.FetchProfile(UserName); } There are two things I might do in my presentaion layer (webpage), 1- populate some text boxes (fields of the record which was fetched) I use the following code: foreach (DataRow row in ThisDataSet.Tables["StudentT"].Rows) { //ThisStudent.FirstName = row["FirstName"].ToString(); } 2- populate a grid view ( which is easy by assigning its datasourse to the dataset which was returned) one thing is that the point of having 3 layered is not having any codes related to database, but I have to have a dataset in my page ! I have read a lot that this isn't such a good way of implementing 3 layer architecture, I'm working on my final project and I need something not too much confusing. I would really appreciate it if you could send me a sample of redirect me to a page ( again as I mentioned before, I 'm looking for something less confusing and easy to implement), so I can finish it and also learn something. Regards, K

    G 1 Reply Last reply
    0
    • M mrkeivan

      Hey guys, I have searched about this on the new and here but I'm still confused, so I'm gonna lay out this and hopefully with your help I can get it over with. I'm trying to design and implement a 3 layer web application, I want to fetch the info(fields such as name, email, ... ) for a student from Student table in my database: (consequently I want to do update, delete and insert as well) In my DAL class I fetch the record from database and return a dataset: public DataSetFetchProfile(string UserName) { DataSet ThisDataSet = new DataSet(); ThisAd.SelectCommand = new SqlCommand("Profile_FetchStudentInfo", ThisConnection); ThisAd.SelectCommand.CommandType = CommandType.StoredProcedure; ThisAd.SelectCommand.Parameters.Add("@UserName", SqlDbType.NVarChar, 256).Value = UserName; ThisAd.Fill(ThisDataSet, "StudentT"); return ThisDataSet; } and I have this function in my BLL class calling this one: public DataSet ReturnProfileInfo(string UserName) { return ThisStudent.FetchProfile(UserName); } There are two things I might do in my presentaion layer (webpage), 1- populate some text boxes (fields of the record which was fetched) I use the following code: foreach (DataRow row in ThisDataSet.Tables["StudentT"].Rows) { //ThisStudent.FirstName = row["FirstName"].ToString(); } 2- populate a grid view ( which is easy by assigning its datasourse to the dataset which was returned) one thing is that the point of having 3 layered is not having any codes related to database, but I have to have a dataset in my page ! I have read a lot that this isn't such a good way of implementing 3 layer architecture, I'm working on my final project and I need something not too much confusing. I would really appreciate it if you could send me a sample of redirect me to a page ( again as I mentioned before, I 'm looking for something less confusing and easy to implement), so I can finish it and also learn something. Regards, K

      G Offline
      G Offline
      Gamzun
      wrote on last edited by
      #2

      You've done the right thing, you can have dataset, datatable or class object (orm) in your page, otherwise you can implement your requirement! Let me ask you something, can you tell me what db you're using by looking at ds, dt or object? No, you can't because that's independent of actual database your ds,dt doesn't know from what type of db they're getting data.

      Please don't forget to mark 'Good Answer', if you find it really a good one! Kashif

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups