| | |
How to retriev data frm DB in datacombo
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
Views: 916 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 2008 access add application array assignment basic box button buttons center class click code combo convert cpu data database datagrid datagridview design designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees error excel exists firewall function image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net opacity page pan picturebox port print printing printpreview problem record refresh regex reports" reuse right-to-left save savedialog search serial socket sorting sql sqldatbase storedprocedure string structures studio temp textbox timer txttoxmlconverter upload useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web wpf xml






