Using VB.Net, C#.Net and SQL Server.
Windows Application
I want to separate a code for 3 Tier Architecture(Presentation Layer, Data Access Layer,
Business Logic Layer).
Code.
Form_Load
Dim cmd As New SqlCommand
Dim ada As New SqlDataAdapter
Dim ds As New DataSet
Con = New SqlConnection("Data Source='" & servername.Text & "';Initial Catalog='" & databasename.Text & "';Integrated Security=true")
Con.Open()
cmd = New SqlCommand("Select * from tb1", Con)
ada = New SqlDataAdapter(cmd)
ada.Fill(ds, "tb1")
datagrid2.DataSource = ds.Tables("tb1")
Above code is working, But i want to do a same process by using 3 Tier Architecture.
How to separate my code according to 3 tier Architecture.
Need VB.Net Code Help
you can make a class library project for every layer except UI layer. Then you must breakdown each process to this 3 layer. for example do every data accessing in Data Access Layer and put every logic in Logic Layer. at the UI you can’t work with DAL directly. you should only call methods that defined in BLL.
Note: add these layers to UI by adding dll of per layer as reference to UI Project.
DAL
BLL
UI