Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 26th, 2007, 06:58 PM
Registered User
 
Join Date: Dec 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Data from Recordset

Hi, this is probably the worse question anyone has asked, but here goes.
I have a connection to my sql db, using vb05, I can dump the recordset into a datagridview object with little effort, but, when querying for single record and single field, I cant seem to dump the returned value to a variable,

eg:
       sqlConnect.Open()

        ' Dim y As Integer
        Dim sql As String
        Dim series As String

        sql = "select Series from ModelMstr where partno='" + Part + "'"

        Dim cmd As SqlCommand
        cmd = New SqlCommand(sql, sqlConnect)

        Dim adapter As SqlDataAdapter
        adapter = New SqlDataAdapter(cmd)
        Dim row As Integer

        Dim ds As DataSet
        ds = New DataSet()
        adapter.Fill(ds)
        'Dim x As String
        Me.DataGridView1.DataSource = ds
        Me.DataGridView1.DataSource = ds.Tables(0)
        Me.ComboBox1.DataSource = ds
        Me.ComboBox1.DataSource = ds.Tables(0)
        Me.ComboBox1.DisplayMember = "PartNumber"
        Series=Combobox1.text


Reply With Quote
  #2 (permalink)  
Old January 17th, 2008, 12:08 AM
Registered User
 
Join Date: Jan 2008
Location: , , Australia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you need to also assign the .ValueMember property to "PartNumber" as well when setting the datasource. I may be wrong but try it.

Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to bind data from a recordset to a combobox? wayne62682 Access VBA 6 April 2nd, 2006 08:45 PM
Structuring Recordset data brendonsmith XSLT 2 January 19th, 2004 06:14 PM
How Do I Reuse data from a RecordSet? steve456 Classic ASP Professional 2 October 21st, 2003 05:30 AM
Can't pull data from ntext field into recordset. rstelma Classic ASP Databases 1 August 26th, 2003 03:21 PM



All times are GMT -4. The time now is 02:18 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.