Documente Academic
Documente Profesional
Documente Cultură
& "database=db_gino"
Try
objconn.Open()
objconn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Form2.Show()
Me.Hide()
End Sub
End Class
Public Class Form2
With objcmd
.Parameters.AddWithValue("@field1", txtusername.Text)
.Parameters.AddWithValue("@field2", txtpassword.Text)
End With
objconn.Open()
objcmd.ExecuteNonQuery()
objdr = objcmd.ExecuteReader
If (objdr.Read()) Then
objcmd.Dispose()
objdr.Close()
Form3.Show()
Me.Close()
Else
End If
objcmd.Dispose()
objdr.Close()
End Sub
End Class
Form4.Show()
End Sub
Form5.Show()
End Sub
Form6.Show()
End Sub
Form7.Show()
End Sub
Form8.Show()
End Sub
Application.Exit()
End Sub
End Class
Public Class Form4
With objcmd
.Parameters.AddWithValue("@field1", TextBox1.Text)
.Parameters.AddWithValue("@field2", TextBox2.Text)
End With
objcmd.ExecuteNonQuery()
objcmd.Dispose()
MsgBox("Record Added!")
Me.filllistview()
Dim ab = MsgBox("Register another one?", vbYesNo)
If ab = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
Else
TextBox1.Text = ""
TextBox2.Text = ""
End If
End Sub
Sub filllistview()
Try
ListView1.Items.Clear()
objdr = objcmd.ExecuteReader
While (objdr.Read())
With ListView1.Items.Add(objdr("Product"))
.subitems.add(objdr("Price"))
End With
End While
objcmd.Dispose()
objdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
Me.filllistview()
End Try
End Sub
Me.filllistview()
ListView1.View = View.Details
End Sub
Private Sub ListView1_MouseClick(sender As Object, e As MouseEventArgs) Handles
ListView1.MouseClick
With ListView1.SelectedItems(0)
TextBox1.Text = .SubItems(0).Text
TextBox2.Text = .SubItems(1).Text
End With
End Sub
objcmd = objconn.CreateCommand()
With objcmd
.Parameters.AddWithValue("@field1", TextBox1.Text)
.Parameters.AddWithValue("@field2", TextBox2.Text)
objcmd.ExecuteNonQuery()
filllistview()
MsgBox("Update Record!")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
End With
End Sub
objcmd = objconn.CreateCommand()
With objcmd
.Parameters.AddWithValue("@field1", TextBox1.Text)
objcmd.ExecuteNonQuery()
filllistview()
MsgBox("Delete Record!")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
End With
End Sub
Try
ListView1.Refresh()
ListView1.Items.Clear()
With objcmd
.Parameters.AddWithValue("@field1", TextBox3.Text)
End With
objdr = objcmd.ExecuteReader
While (objdr.Read())
With ListView1.Items.Add(objdr("Product"))
.subitems.add(objdr("Price"))
End With
End While
objcmd.Dispose()
objdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
Me.filllistview()
End Try
End Sub
Form3.Show()
Me.Hide()
End Sub
End Class