Code:Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'DataSet1.Visits' table. You can move, or remove it, as needed. Me.VisitsTableAdapter.Fill(Me.DataSet1.Visits) 'TODO: This line of code loads data into the 'DataSet1.Customer' table. You can move, or remove it, as needed. Me.CustomerTableAdapter.Fill(Me.DataSet1.Customer) 'TODO: This line of code loads data into the 'DataSet1.Visits' table. You can move, or remove it, as needed. Me.VisitsTableAdapter.Fill(Me.DataSet1.Visits) Dim con As New SqlConnection Dim sqlConnection1 As New SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True") Dim cmd As New SqlCommand Dim reader As SqlDataReader cmd.CommandText = "SELECT * FROM Visits WHERE CustomerID = ?" cmd.CommandType = CommandType.Text cmd.Connection = sqlConnection1 sqlConnection1.Open() reader = cmd.ExecuteReader() ' Data is accessible through the DataReader object here. sqlConnection1.Close()




Reply With Quote
