Jump to content

C# Web Forms And Using Linq

Recommended Posts

Hello,I am working on my final project for school and I have to post certain form tasks to the database. I am not all that sharp on every aspect of data connections yet and am struggling. I am using the connection that visual studio creates when you drag and drop the table on the form. It is all working great when I do things by my book, but my teacher asked us to insert something into the data base and I cannot figure out that part. I was looking at an article online about saving something to the database, but it was creating a new object of the class for a specific table and they did not have a visual of the class. I started fumbling my way through that and it was not going too well. I need some more specific help because I am not educated enough yet to figure this out in the time frame I have. Here is part of my code. I want to insert the info in the fields into the database once it passes the test. The test works fine. private void regSubmitButton_Click(object sender, EventArgs e){byte use = Convert.ToByte(userIDBox.Text); string pass = passBox.Text; this.lib_UserTableAdapter.Fill(this.libraryProjDataSet.Lib_User); var match = from u in this.libraryProjDataSet.Lib_User where (u.User_ID == use) select u.User_ID; var match3 = from u in this.libraryProjDataSet.Lib_User where (u.Password == pass) select u.Password; try{ if (match.Count() != 0 || match3.Count() != 0){userIDBox.Text = " ";passBox.Text = " ";errorUlabel.Visible = true;}else{mainPage MainPage = new mainPage();MainPage.Show(); }

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...