Advertisement
Anan99

Untitled

May 1st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1.  
  2. static class BookVariables
  3. {
  4. public static string BookName ="";
  5.  
  6. public static string BookGenre = "";
  7. public static string BookAuthor = "";
  8. public static char Hallway = '\0';
  9. public static int BookClass = 3;
  10. public static char shelf = '\0';
  11. public static int CopiesNo = 0;
  12. public static string ISBN = "";
  13.  
  14. public static void clear()
  15. {
  16. BookGenre = "";
  17. BookName = "";
  18. BookAuthor = "";
  19. Hallway = '\0';
  20. BookClass = 3;
  21. shelf = '\0';
  22. CopiesNo = 0;
  23. ISBN = "";
  24.  
  25.  
  26. }
  27. }
  28.  
  29. private void Save_Click_1(object sender, EventArgs e)
  30. {
  31. SqlConnection con = new SqlConnection("Data Source=DESKTOP-FH9M09N\\ANANSQLSERVER;Initial Catalog=UniLibrary;Integrated Security=True");
  32. SqlCommand sqlCommand = new SqlCommand("insert into Book Values('" +1 + "','" + BookVariables.BookName
  33. + "','" + BookVariables.BookAuthor + "','"+BookVariables.BookGenre + "','"+BookVariables.BookClass + "','"
  34. +BookVariables.shelf + "','"+BookVariables.Hallway + "','"+BookVariables.ISBN + "','"+
  35. BookVariables.CopiesNo+"')",con);
  36. sqlCommand.Connection = con;
  37. con.Open();
  38. sqlCommand.ExecuteNonQuery();
  39. con.Close();
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement