Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai to all


I am doing a project in vb.net in my database i have 5 different titles .
the following coding are used for database retrieving the database datas.
(<pre lang="vb">Try
conopen()
cmd = New SqlCommand(&quot;select PROJECT_TITLE from PRO_DETAILS &quot;, con)
ada = New SqlDataAdapter(cmd)
ds = New DataSet()
ada.Fill(ds)
Dim i, a As Integer
a = ds.Tables(0).Rows.Count
For i = 0 To a - 1
rw = ds.Tables(0).Rows(i)
ComboDDtitle.Items.Add(rw(&quot;PROJECT_TITLE&quot;).ToString())
Next
Catch ex As Exception
MsgBox(&quot;Error&quot;)
End Try</pre>
)
but it running the count up to five times ,but i want only one time run it and displayed in the combobox for choosing a particular title.


Thanks in Advance,
Rajeshkumar
Posted

1 solution

Using a DISTINCT in your query will give you a set of distinct Project_Titles.
Try that out.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900