I want to retrive data from table to combobox I used this coding though I didn't get an error the outpiut(data) is not displaing in the combobox
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MessageBox.Show("Please Insert the Sample note no", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Try
myConnection = New SqlConnection(connectionstring)
myConnection.Open()
''''''''''''
myCommand1 = New SqlCommand(" SELECT [User_Id] ,[P_Id],[Quantity],[Category] ,[S_Name]FROM [VBP].[dbo].[Purchase_Order] Where [O_N0]='" & Val(TextBox3.Text) & "'", myConnection)
Dim dr As SqlDataReader = myCommand1.ExecuteReader
While dr.Read()
' Insert into Product_Details (P_Id,Category,Quantity,Date,Time,Name,P_Purchased_Price,P_selling_Price,No_Of_Units_Purchased_last,Profit_Margin,Discount,Discounted_Price) values ('" & pid & "','" & pc1 & "','" & quantity & "','" & date1 & "','" & TextBox1.Text & "','" & Name & "','" & pp & "','" & sp & "','" & TextBox3.Text & "','" & profit.Text & "','" & TextBox7.Text & "','" & TextBox2.Text & "
TextBox1.Text = (dr(0))
' ComboBox2.Text = Val(dr(1)).ToString
TextBox4.Text = Val(dr(1))
'ComboBox3.Text = Val(dr(5)).ToStrin3
' ComboBox1.Text = Val(dr(3)).ToString
' ComboBox3.Text = Val(dr(4)).ToString
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'currentbalance = Double.Parse(dr(2).ToString)
End While
Dim ds As DataSet = New DataSet
ComboBox3.DataSource = ds.Tables("Purchase_Order")
ComboBox3.DisplayMember = "S_Name"
ds = Nothing
Catch err As Exception
MsgBox(err.Message, MsgBoxStyle.Exclamation)
End Try
End Sub