Viewing Records in a listbox
I am trying to add the First Name of the members added in the database to be able to view them whenever i want to
Public Class adduser
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddUser.Click
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim rdr As SqlDataReader
cn.ConnectionString = " data source = Rayon\Rayon; Initial catalog = Library; uid=sa; password = minnie"
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = "Insert into Member (FName, MidName, LName, Street1, Street2, City, Zone, ContactHome, ContactWork, ContactCell, Email, Gender) values ('" & txtFname.Text & "', '" & txtMidName.Text & "' , '" & txtLname.Text & "', '" & txtStreet1.Text & "', '" & txtStreet2.Text & "' ,'" & txtCity.Text & "' ,'" & cbZone.Text & "' ,'" & txtHome.Text & "', '" & txtWork.Text & "' ,'" & txtCell.Text & "' ,'" & txtEmail.Text & "' ,'" & cbGender.Text & "' )"
cmd.CommandText = "select FName, LName from Member"
rdr = cmd.ExecuteReader
Do While rdr.Read
However when this is executed and a record is inserted, when i load the view form the first names are listed. If i close the view form(listbox) and reopen the values are gone.
I want to be able to view the members even without have to add a record