Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If Button1.Text = "Add Movie" Then
- Button1.Text = "Save Movie"
- ComboBox1.Items.Clear()
- Me.box()
- Me.access()
- Button2.Text = "Cancel"
- ElseIf TextBox1.Text = "" Then
- MsgBox("Please enter movie title", vbCritical, "Add Movie")
- TextBox1.Focus()
- ElseIf ComboBox1.Text = "- Please Select -" Then
- MsgBox("Please select movie category", vbCritical, "Add Movie")
- ComboBox1.Focus()
- Else
- cmd = New SqlClient.SqlCommand
- cmd.CommandText = "select * from tblInfo where Title='" & TextBox1.Text & "'"
- cmd.Connection = conn
- dr = cmd.ExecuteReader
- If dr.HasRows Then
- MsgBox("Movie has been already watched!", vbExclamation, "Add Movie")
- Me.clear()
- Else
- cmd.CommandText = "Insert Into tblInfo(Title, Category) Values('" & TextBox1.Text & "', '" & ComboBox1.Text & "')"
- cmd.ExecuteNonQuery()
- MsgBox("Successful Saved!", vbInformation, "Add Movie")
- Button1.Text = "Add Movie"
- Button2.Text = "Delete Movie"
- Me.clear()
- Me.box()
- Me.unaccess()
- Me.showList()
- cmd.Dispose()
- dr.Close()
- End If
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement