Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. SqlConnection connection = new SqlConnection("Data Source=redacted.database.windows.net,1433;Initial Catalog=hmsproject;User ID=xxxx;Password=xxxx");
  2.  
  3. SqlDataAdapter sqladp = new SqlDataAdapter();
  4.  
  5. string query = "INSERT INTO reservations(username,mobile) VALUES('" + TextBox1.Text+"','"+TextBox2.Text+"')";
  6.  
  7. try
  8. {
  9. connection.Open();
  10.  
  11. SqlCommand command = new SqlCommand(query, connection);
  12. sqladp.SelectCommand = command;
  13. }
  14. catch (Exception ex)
  15. {
  16. }
  17.  
  18. Dim conn As New Data.SqlClient.SqlConnection("Data Source=redacted.database.windows.net,1433;Network Library=DBMSSOCN;Initial Catalog=hmsproject;User ID=xxxx;Password=xxxx")
  19.  
  20. Dim SDA As New SqlDataAdapter
  21.  
  22. Try
  23. conn.Open()
  24. Dim Query As String
  25. Query = "INSERT INTO reservations (username, number) values ('" & TextBox1.Text & "','" & TextBox2.Text & "')"
  26. Command = New SqlCommand(Query, conn)
  27. SDA.SelectCommand = Command
  28.  
  29. Label2.Text = "Awdawd"
  30. conn.Close()
  31. Catch ex As SqlException
  32. MsgBox(ex.Message)
  33. Finally
  34. conn.Dispose()
  35. End Try
  36. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement