This piece of code is returning the multiple values of Category in MsgBox one by one. How can i make it to show all the values of category in one MsgBox separated by commas and store it in a String?
Code:Try Using connection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ProjectMW\MachineWale\MachineWale\DatabaseMW.mdf;Integrated Security=True;User Instance=True") connection.Open() Using command As New SqlCommand("SELECT * FROM MachineProfile where ClientID = '" & MDIParentMW.clid & "'", connection) Using reader As SqlDataReader = command.ExecuteReader() If reader.HasRows Then While reader.Read() MsgBox(reader("Category")) End While Else End If End Using End Using connection.Close() End Using Catch ex As Exception MsgBox(ex.ToString, MsgBoxStyle.Exclamation) End Try




Reply With Quote