Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen I start the application, the database drops
    primarykey
    data
    text
    <p>I'm working on a small Information System Application. I'm making it with windows forms and Service-based Database. It's almost done but when I execute the application a very odd problem appears. I make a stored procedure for inserting data in db tables and when i execute it manually it all works fine, but when I start the program and execute the procedure through button click something wrong is happened. At first sight the program is working fine and the procedure is executing well, but the data is not stored in the db. Here is my code:</p> <p>UserData.cs</p> <pre><code> public static bool AddStudent(Student std) { UserDataClassesDataContext dc = new UserDataClassesDataContext(); try { dc.AddNewStudent(std.FirstName, std.SecondName, std.LastName, std.Faculty, std.Specialty, std.OKS, std.StudentStatus, std.FacNumber, std.Course, std.Potok, std.Group); dc.SubmitChanges(); } catch (Exception) { return false; } return true; } </code></pre> <p>StudentValidation.cs</p> <pre><code>public bool InsertStudent(Student std) { return UserData.AddStudent(std); } </code></pre> <p>MainForm.cs buttonClick event</p> <pre><code>private void insertStudentButton_Click(object sender, EventArgs e) { Student student = new Student(); student.FirstName = tbFirstName.Text; student.SecondName = tbSecondName.Text; student.LastName = tbLastName.Text; student.Faculty = tbFacultyName.Text; student.Specialty = tbSpecialty.Text; student.FacNumber = tbFacNumber.Text; student.OKS = (short)cbOKS.SelectedIndex; student.StudentStatus = (short)cbStudentStatus.SelectedIndex; student.Course = (short)numCourse.Value; student.Potok = tbFlow.Text; student.Group = tbGroup.Text; if (sv.InsertStudent(student) &amp;&amp; sv.InsertUser(student)) MessageBox.Show("The student is added successfully!"); else MessageBox.Show("A problem occurs while trying to add the student!"); } </code></pre> <p>I think that the db is somehow disconnected when I start my application, but I don't know why. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload