开发者

Using the entity framework model to store textbox values

开发者 https://www.devze.com 2023-02-28 17:42 出处:网络
I am fairly new to ASP.NET andI am trying to figure out how to use the entity framework model to data from a textbox field and store it in an existing field in a database which is available to the app

I am fairly new to ASP.NET and I am trying to figure out how to use the entity framework model to data from a textbox field and store it in an existing field in a database which is available to the application .

I looked around on the internet and开发者_开发百科 some solutions were to use a detailView but that would require me to recode the entire page and I would like to avoid that.

Can anyone provide any inputs on how to go about that ?

Thanks !!


For an introduction to using EF with ASP.NET see the tutorials at http://asp.net/entity-framework/tutorials -- there are two series there for Web Forms and one for MVC. Both of them have examples of using textboxes.


var context = new MyEntities();
var myObject = new myObjectType();
myObject.myValue = myTextBox.Text;
context.myObjectTypes.Add(myObject);
context.SaveChanges();
0

精彩评论

暂无评论...
验证码 换一张
取 消