| | |
How to retriev data frm DB in datacombo
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
VB.NET Syntax (Toggle Plain Text)
Private Sub ReadData() Dim i As Integer con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source= D:\Only Me\Authors.mdb") Try cmdOle = con.CreateCommand cmdOle.CommandText = "SELECT * FROM Authors " da.SelectCommand = cmdOle da.Fill(dsOle, "Authors") dtOle = dsOle.Tables("Authors") For i = 0 To dtOle.Rows.Count - 1 cmbAuthor.Items.Add(dtOle.Rows(i).Item(1)) Next Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!") End Try con.Close() End Sub
in looping function ReadData will fill cmbAuthor with 2nd column from table author (.item(1), index start from 0).
cmbAuthor.Items.Add(dtOle.Rows(i).Item(1)) Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
I was told u in previous post, I said the index of item means index of column on your table.but you can change with :
cmbAuthor.Items.Add(dtOle.Rows(i).Item("ColumnName"))
cmbAuthor.Items.Add(dtOle.Rows(i).Item("ColumnName"))
Last edited by Jx_Man; Sep 29th, 2008 at 12:14 am.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: help with code.
- Next Thread: how to create setip in vb.net
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf






