Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2007, 11:17 AM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default MS Access - Connecting to

Hi All,

I've been a member of the MSAccess forum for quite awhile. With my new job, they have provided me, for programming purposes VB.Net Express edition.

Haven't got a clue!!

Need to open an MS Access table to load a combobox, in a form load event.

For the life of me, I can't figure out the connection strings!

Please help!

Thanks,

Kevin


dartcoach
__________________
dartcoach
 
Old February 27th, 2007, 11:33 AM
Authorized User
 
Join Date: Nov 2006
Location: , , USA.
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196
Default

You could the "Add New Datasource" wizard and then copy the connection string info into your code.



Best Regards,
Earl Francis
 
Old February 27th, 2007, 12:05 PM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm not getting any errors but I'm also not getting any data.
here's the code I'm using:
        Dim conn As New sqlclient.sqlconnection
        Dim cmd As New sqlclient.sqlcommand
        Dim dr As sqlclient.sqldatareader
        conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "xxxxx\Mods.mdb"
        cmd.connection = conn
        conn.open()
        cmd.CommandText = "Select * from Mods"
        combobox1.items.clear()
        combobox1.items.add("")
        dr = cmd.executeReader
        While dr.read()
            combobox1.items.add(dr(0))
        End While
        dr.close()
        conn.Close()
    End Sub

Thanks for your help.

Kevin

dartcoach




Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access connecting to Oracle Problem Corey Oracle 2 March 21st, 2007 02:52 AM
Connecting MS Access using Struts roopesh_dubey Struts 0 February 18th, 2007 02:43 AM
connecting PHP to MS Access pb7 Beginning PHP 5 September 24th, 2004 05:04 PM
connecting PHP to an MS Access database pb7 PHP Databases 1 September 18th, 2003 04:28 PM
Problem: JSP connecting to MS Access amcp2002 JSP Basics 3 August 12th, 2003 12:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.