| | |
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 |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year






