Hi all... I could use a little TLC here for understanding and not forsolving a specific problem... sorry if I''ve got the wrong group, but I''musing VB so I figured this was the most appropriate one.I''m an advanced beginner, but in all of the books and class material I have,I haven''t found something that gets to the point about this... lot''s of highlevel theoretical talk, but nothing that says things in simple terms.I''m building an app and want to separate the presentation and data "stuff".Here''s some background on the approach I want to take as I understand it:In my VS project (an ASP.NET project), I''ve got 3 important things:1) Submit.aspx -- this is the presentation "thing". It contains mostlyjust web controls. Textboxes, a DateTime control (from a vendor), labels,and a submit button. For example purposes, let''s say the fields are:FullName, PhoneNumber, DOB.2) DataLayer.vb -- this is my "data" stuff. It contains a class called"User" that is a model of the data in my form. So, there are read/writeproperties for FullName, PhoneNumber and DOB. Also, there''s a method called"SaveToDB" that does exactly that--- opens a database connection and Insertsthe data into a table.3) Submit.aspx.vb -- The code-behind for Submit.aspx... there''s an eventhandler here for the Submit button that:- instantiates an object based on the User class- sets the properties of this object using values from the web controls- calls the SaveToDB method on that object to write the values to theDatabase.My questions are:1) I might also like to write a couple of other classes, possibly to handlevalidity... is it appropriate for me to write them in the DataLayer.Vb? Myconfusion is because in Visual Studio, when I add a new item, it refers toit as a "Class"... is this only supposed to contain ONE class?2) Is this approach reasonable--- I know this is a small app... just anexample, but if it were a lot bigger (i.e. more controls on the form, morefields, etc), would this be the right approach? If not, what am I doingwrong?3) In an app like this, where you are submitting information in a form, isit better to postback and hide the form to display success, or is itconsidered better practice to submit to a second page and have that pagecall my data layer?Thank you in advance for your time...Michelle 解决方案 这篇关于将演示文稿与数据层分开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-31 12:11