0

I newly born in asp.net world! trying initial steps towards it's learning. I have developed small application in WPF that performs CRUD operations. I have used: ADO.Net Connectivity and code below to perform these CRUD(Create/Insert, Read/Load, Update/Edit and Delete/ Remove) rows from GridControl:

NorthwindEntities dbContext = new NorthwindEntities();

Category category = new Category();
category.CategoryName = "Test Category";

Product firstProduct = new Product();
firstProduct.ProductName = "Test Product 1";

Product secondProduct = new Product();
secondProduct.ProductName = "Test Product 2";

category.Products.Add( firstProduct );
category.Products.Add( secondProduct );

dbContext.AddToCategorySet( category );
dbContext.SaveChanges();

Questions:

1: I want to do exactly this same thing in Asp.net, using ADO.net Connectivity.

2: Can i use this similar code in my asp.net CRUD application?.

2
  • 1
    ASP.Net is just a giant set of .Net classes. You can write any code you want. Commented Nov 5, 2013 at 15:17
  • @SLaks thank's for replying :) can i use this above? Commented Nov 5, 2013 at 15:20

1 Answer 1

1

I think you are confused about ASP and WPF.

ASP and WPF are both frontend ways to display data from backend code. This backend code is .NET in both cases. Apart from any code related to frontend (like the generation of controls and the display of data), you can use exactly the same code in both cases. In fact, there are several programs which do just that: they have a central codebase for connectivity with the database + the business logic for their client windows based apps and their server based apps, and the only difference between the 2 is the code which is directly linked to the frontend.

So yes, your code you displayed above will work perfectly in ASP. The only things you won't be able to use from your WPF is what's directly related to your frontend, so the code that directly interacts with your WPF form frontend.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.