Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Database and Reporting > oleDB vs SQLclient


Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2005, 12:04 PM
fixitchris's Avatar
fixitchris fixitchris is offline
Contributor
 
Join Date: Dec 2004
Posts: 418
Default oleDB: Datasets and Data Sources


Can I connect to a local Access database using the SQLclient if I'm not running SQLserver? or is my only option oleDB?

Last edited by fixitchris; 08-18-2005 at 01:54 PM.
Reply With Quote
  #2  
Old 08-18-2005, 12:17 PM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

SQLClient is for SQL Server only.
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
  #3  
Old 08-18-2005, 12:40 PM
fixitchris's Avatar
fixitchris fixitchris is offline
Contributor
 
Join Date: Dec 2004
Posts: 418
Default

Code:
Dim ds1 As DataSet = New Data.DataSet
        Dim da1 As New OleDb.OleDbDataAdapter(sSQL, dc1)
        Dim dr1 As DataRow
        da1.Fill(ds1, "Items")
        ListBox1.Items.Clear()
        For Each dr1 In ds1.Tables("Items").Rows
            ListBox1.Items.Add(dr1("item"))
        Next
This code populates a ListBox with the Dataset values with the ITEM column out of the DB. What I'm trying to do is when I click on an item in the ListBox to call that row in the dataset and fill a text box with the PARTNUM column from the current dataset row.


WAYNEPH, I'm new to ADO.NET and i'm just trying to find the best solution for data access. My issue now is how to use the Typed Datasets set up inside the DATA SOURCES.

Last edited by fixitchris; 08-18-2005 at 01:08 PM.
Reply With Quote
  #4  
Old 08-18-2005, 12:45 PM
wayneph's Avatar
wayneph wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

what does the code show us?

Are you getting an error? What type of object is sSQL?
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #5  
Old 08-18-2005, 01:38 PM
fixitchris's Avatar
fixitchris fixitchris is offline
Contributor
 
Join Date: Dec 2004
Posts: 418
Default

ssql is a string , SELECT statement

i figured out to put a BindingSource Control onto my form and that added the typed dataset dsPitem to my form as well. this is the updated code

Code:
'data access using OLEDB [COLOR=DarkRed]Dim dc1 As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\chrism\Desktop\qs2.net test\db.mdb")[/COLOR] Dim da1 As New OleDb.OleDbDataAdapter(sSQL, dc1) Dim dr1 As DataRow da1.Fill(DsPitem, "Pitem") ListBox1.Items.Clear() For Each dr1 In DsPitem.Tables("Pitem").Rows ListBox1.Items.Add(dr1("item")) Next

1. instead of creating this OLEDBCONNECTION object, how can i make reference to the Connection object I created when creating the typed datasets? I named it dbConn but i dont' know how to use it in my code.

2. do i still need to call the SQL statement to the dataAdapter with Typed Datasets?

The whole purpose for this project is to familiarize myself with ADO.NET.
A. Populate List Box with [item] from dsPitem dataset
B. create Form2 on Listbox1_click event
C. Populate Listview on Form2 with records from dsRouting dataset that match the [item] field selected on form1.listbox
Attached Images
File Type: jpg dsource.jpg (49.1 KB, 5 views)
File Type: jpg form1.jpg (16.8 KB, 4 views)
File Type: jpg form2.jpg (10.0 KB, 3 views)

Last edited by fixitchris; 08-18-2005 at 01:50 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->