ADO.NET :: Insert Into 3 Related Tables Using Three Tier Architecture And Typed Datasets
Aug 29, 2010
I am using ASP.NET (C# and sql server express 2005) for my web application project. I have three related tables. I want to do an insert using typed datasets,tableadapters and three tier architecture. I wish to know how to do simultaneous inserts in 3 tables. So i wish to insert a row in first table and get its primary key. Same with the second table. I will use the primary keys of those first two tables to do the insert in the third table. How can i accomplish this using formview control and what methods should i use??
I have developed a web site that uses strongly typed datasets to access SQL. This has worked well: I have found that this is easy and robust, so that if I make changes to the data structure invariably I am either protected from this and my code continuesto work correctly, or there are compile errors that are obvious and easily fixed. Thus I am a fan of typed datasets.I am now starting to learn how to use web services, as I need to use the site's database with Windows programs. I have a web service with the following code, passing back a datatable: -
<WebMethod()> _ Public Function GDBSearch(arguments) As DataTable Dim tbGDBSearch As DataTable = taGDBSearch.GetData(arguments)
recently i've studied on ADO.NET's Entity Model Framework and say 'wow' as ORM is one of the fevourite pattern i practice..but suddenly i've come to an ambiguous situation when i'm going to start. i usually follow the following 3-tier architecture..
1. UI Layer 2. BLL - business logic layer 3. DAL - Data Access Layer a. DTO / DAO b. Gateway (contains the sql query/stored procedure and connection with DB)
now when i'm going to use the Entity Model Design,where the DBML/ .edmx File should be placed? Because many a times i'm using the DBML file as DTO because of the mapped objects.. in the same time, sometimes DBML ( .edmx file in .NET 4.0) contains CRUD methods and stored procedured method as well as methods with different selection operations,- which should be in Gateway. so where the .edmx file should be placed !?!! IN DTO namespace !? or in Gateway namespace!
moreover sometimes there is no need for the BLL which breaks the rules of inter-layer-communication (UI > BLL > DAL.Gateway)! what makes me confuse is, what should be the ideal n-tier architecture when i'll use the ADO.NET Entity Model Design Framework
I am working on 3 tier architecture: UI, BL, DAL. In my UI i have following code for Asynchronous page processing:
But I want a database fetch operation to be performed in this asyncronous method. And due to 3 tier arch. i am unable to do this in UI Layer. Can anyone guide me that how can I implement Asynchronous processing in 3 tier architecture? Note: If you are going to place EndAsyncWork1 in DAL then show that how can I return a value back to UI layer from this function.
I have implemented the 3-tier architecture project; DAL, BAL, and presentation layer are three layers in it. I am going to implement the following scenario:
Presentation layer calls to a function in the BAL layer which returns 2 string variable, and in turn this function from BAL layer calls to a DAL layer function which also returns 2 string variable. How can I implement the above scenario?
I was tasked to create 3 tier web application. However, i browsed through many books & tutorials. The examples are doing it using Object data source which my lecturers claimed that it is not 3 tier at all. Shouldn't be dragging any data source into deisgn view. Any comprehensive examples for me to take reference from?
(1).MSDN say that we should not have the namespace where its name is same with class name but it does not exlpain why.Does anyone know why? The msdn page is http://msdn.microsoft.com/en-us/library/893ke618%28VS.71%29.aspx
(2). Business Logic Layer BLTable1 need to interact with Data Access Layer DaTable1 , so i put the code: imports MyCompany.MyProject.DA. DaTable1 inside BLTable1, so that i can have access to all the public shared method inside DaTable1 in BLTable1 for example : DaTable1.Save()
But problem arise when BLTable1 want to use the public shared method in BLTable2 .
I have put the code imports MyCompany.MyProject.BL. BLTable2 inside BLTable1,but i need to key in the class name twice only can access to the public shared method inside BLTable2 for example :BLTable2.BLTable2.Save.
i am using datasets as part of my web application architecture.
i have one dataset which has two tables which are populated from database . everything works fine but when i have change in stored procedure. i change structure of datatable in dataset file after that compilation errors start to throw up. when i check cs file of dataset it shows multiple classes with different names.
cant get into it. since im using datasets for first time. its getting frustating.
I am updating a project I wrote some time ago. At the time my preference was for DataSets and DataSetTableAdapters, but I've now moved on to use Linq to SQL DataClasses. I would like to convert the project to Linq to SQL, but I am tight on time and it's a big job. My question is, is there any reasons I can't develop new modules using Linq to SQL DataClasses along side DataSets and convert the DataSets overtime?
Apart from the obvious confusion it will cause, are there any technical problems I should be aware of i.e. will there be any performance problems using the two methods?
In 3 tier architecture where to keep connection string? I have presentation layer ( webapplication) and BAL Layer ( class lib) and DAL (class lib).intially i kept in web.config which is in presentation layer....is it correct?should i keep a app.config file in DAL layer and keep my connection string in that?Where to keep connection string ?
My application was designed using following n-architecture : Presentation layer...wcf service layer...business logic layer..data access layer Presentation layer is in one server,wcf service,bll,dal are in another server. I knew something about wcf but how to implement this architecture.
I am looking for code sample for the above type of architecture.