asp.net - c# database connection model -


i'm writing web application in users can register , log in web site.

i've got asp.net web form series of text boxes , submit button. when did same thing in php, when submit button pressed, user class created , contents of text boxes passed adduser() function took parameters , inserted them database, , i'm trying same thing in c#.

ideally, want use mvc type of design. controller (the textboxes , button) should gather information in text boxes, , pass model (the user class), should connect database , perform necessary insert statement. how make class connect database? parameters need?

do need sqldatasource object on page pass constructor of user class? or different?

your controller should this:

[httppost] [actionname("myaction")] public actionresult myaction(mymodel model) {     // ... model has been loaded data form, work it.     // ex: mydatalayer.save(model); } 

set view's form post "myaction" , model created , pre-loaded via model binding.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -