使用vb.net编码时显示数据库详细信息的问题 [英] problem on displaying database details while using the vb.net codings

查看:162
本文介绍了使用vb.net编码时显示数据库详细信息的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有人都高兴


我正在数据库中的vb.net中做一个项目,我有5个不同的标题.
以下编码用于数据库检索数据库数据.
(< pre lang ="vb">尝试
conopen()
cmd =新的SqlCommand(&从PRO_DETAILS中选择PROJECT_TITLE",con)
ada =新的SqlDataAdapter(cmd)
ds = New DataSet()
ada.Fill(ds)
昏暗的我,作为整数
a = ds.Tables(0).Rows.Count
对于i = 0到a-1
rw = ds.Tables(0).Rows(i)
ComboDDtitle.Items.Add(rw(&"PROJECT_TITLE& quot;).ToString())
下一个
异常捕获
MsgBox(& quot; Error& quot;)
结束Try</pre>
)
但它最多可以运行五次,但是我只想运行一次并显示在组合框中,即可选择特定的标题.


在此先感谢,
Rajeshkumar

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

推荐答案

在查询中使用DISTINCT 将为您提供一组不同的Project_Titles.
试试看.
Using a DISTINCT in your query will give you a set of distinct Project_Titles.
Try that out.


这篇关于使用vb.net编码时显示数据库详细信息的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆