|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
populate dropdown with database
I am new to VS.net and havent programmed in about a year, so there are some pretty interesting new items Im trying to figure out here...
I am trying to populate a dropdown box with information from a database -- and basically using a sql statement call to get the info back. I, however, have no idea how the OledbAdapter, etc. stuff works... Does anyone know a good tutorial or can anyone show me how to handle this please? I am trying to access an Oracle db through Ole I guess... ODBC doesnt seem to want to work with VS.net... Thanks in advance. |
|
#2
|
|||
|
|||
|
Simple example in VB.NET
Dim objDS As New DataSet Dim objDA As New OleDb.OleDbDataAdapter Dim dbconn As OleDb.OleDbConnection Dim sqlconstr As String = "insert db connection string here" dbconn = New OleDb.OleDbConnection(sqlconstr) strSql= "select userid, name, surname from names;" objDA = New OleDb.OleDbDataAdapter(strSql, dbconn) objDA.Fill(objDS, "mynames") ' Set up the Combo Dim dt1 As DataTable = objDS.Tables("mynames") Me.combobox.DataSource = dt1 Me.combobox.DisplayMember = "name" Me.combobox.ValueMember = "userid" Last edited by shaunaustin : March 10th, 2004 at 12:01 PM. |
|
#3
|
|||
|
|||
|
A great book is:
Programming with Microsoft Visual Basic.NET This is that book that I used in my senior level VS.NET programming class. It is really good at walking you through step-by-step and it covers a little bit of everything. Good Luck!! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > populate dropdown with database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|