New to this.
I have a database, one table "Logins":
FirstName, LastName, Birthdate, Email
I am using VS2015 and I am using Entity Framework 6 and have my database loaded in through there. I have text boxes and I want the data entered in them to insert into the table "Logins" when submit is clicked.
I've been looking online and watching videos an I just seem to be getting more confused. How do I do this?
This is what I have on the back end code (the front just has the textboxes and submit button):
protected void btnSubmit_Click(object sender, EventArgs e)
{
using (LoginData2Entities lg = new LoginData2Entities())
{
DateTime birthdate = DateTime.Parse(tbBirth.Text);
Logins l = new Logins();
l.FirstName = tbFirstName.Text;
l.LastName = tbLastName.Text;
l.Birthdate = birthdate;
l.Email= tbEmail.Text;
lg.SaveChanges();
}
Nothing is saving to the database. How do I fix this?
lg.Logins.Add(l)?