.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 9th, 2004, 02:59 PM
cavall cavall is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 20 cavall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 8 m 26 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old March 10th, 2004, 09:58 AM
shaunaustin shaunaustin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 shaunaustin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old March 10th, 2004, 11:27 AM
SE_Manager SE_Manager is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Central Ohio
Posts: 4 SE_Manager User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to SE_Manager Send a message via MSN to SE_Manager Send a message via Yahoo to SE_Manager
Lightbulb Good Book

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!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > populate dropdown with database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT