Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET 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 Search this Thread Display Modes
  #1 (permalink)  
Old August 1st, 2004, 12:02 PM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to humour
Default ADODB works but OleDB does not!


Using asp and vb.net I very successfully am able to use ADO technology with MYSQL's - MAXDB database (MAXDB is the successor to SAPDB).

I am confused though, in diagrams I have seen published by WROX ADO relies on OLE DB technology. Why is it that I can't seem to get to the data using the native OLE DB .net provider defined in the .net namespace known as System.Data.OleDB (please provide an explanation or clear my confusion on the technologies involved here).


Where I am getting hung up is on the line of code below, I dont know what I should put in the provider parameter. What I have there now I think is exclusively for SQL-SERVER but I am not sure.

stringConnectionString = "Provider=SQLOLEDB;dsn=contact;user id=CM;password=*****;"
objConnection = New System.Data.OleDb.OleDbConnection(stringConnection String)

Is this possible? Has anyone done it?


If it is not supported are there plans by MYSQL or Microsoft or anyone else to achieve this?



Thanks in Advance.
Reply With Quote
  #2 (permalink)  
Old August 1st, 2004, 12:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Yes, your provider is a SQL Server provider. There has to be a MySQL provider. Not sure what it is though, as I haven't used MySQL. Just out of curiosity, what connection string did you use to connect to MySQL before? Could you post that...

Brian
Reply With Quote
  #3 (permalink)  
Old August 1st, 2004, 01:29 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

1-for connecting to your datasource using the SQL Server .NET Data Provider
(only for Microsoft SQL Server version 7 or above)
your string connection is something like below
------
strConnection="server=YourServer;database=YourData base integrated security=<true/false>;";//also you can add your user an password
-----
2-for connecting to your datasource using the OLE DB.NET Data Provider
(for MS Access,Excel)
your string connection is something like below
----
strConnection="Provider=Microsoft.Jet.OleDb.4.0 data
source=C:\\....\\Northwind.mdb;";//for MS Access
strConnection = "Provider=Microsoft.Jet.OleDb.4.0; data source=C:\\...\\Inventory.xls; Extended Properties=Excel 8.0;";//for Excel
---
3-There are other providers for MYSQL,Oracle you can find them in www.microsoft.com then install them,you would have some new namespaces....
(nevertheless you can connect to your MySQl,Oracle through OLE DB.NET Data Provider but it is clear which one could be better!)

--------------------------------------------
Mehdi.
Reply With Quote
  #4 (permalink)  
Old August 1st, 2004, 02:07 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think against Brian,your Provider is OLE DB.NET provider.

--------------------------------------------
Mehdi.
Reply With Quote
  #5 (permalink)  
Old August 1st, 2004, 04:00 PM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to humour
Default


BMains asked: "Just out of curiosity, what connection string did you use to connect to MySQL before? Could you post that..."

I am not exactly attaching to MySql, I am attaching to MAXDB which is a higher-end product published/maintained by MySql. I am using the PIO-ADODB using vb.net. When I do it in ASP I use ADODB as well the code is practically identical.

I thought since I was using ADODB a MORE native .NET approach using this NameSpace: System.Data.OleDB should be possible. Although I am grateful for the fast and rapid responses to this point nobody has adaquately explained how to do it. I guess what I really need is the provider parameter for the OLEDB connectstring but thus far it has alluded me as to what to type there.

Imports ADODB

Dim daTitles As New OleDbDataAdapter
Dim CustName As String
Dim contADO As New ADODB.Connection
Dim contRS As New ADODB.Recordset
Dim flds As ADODB.Fields
Dim locDS As New DataSet
contADO.ConnectionString = "dsn=contact;user id=CM;password=****;"
contADO.Open()
contRS.Open("select cust_name from customers where cust_name like '%tore%' ", contADO, CursorTypeEnum.adOpenDynamic)
Reply With Quote
  #6 (permalink)  
Old August 1st, 2004, 04:17 PM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to humour
Default


I dont think what I want to do will be possible, I just read the following from this website:

http://www.databaseadvisors.com/newl...tter042004.htm

Here is where a lot of open source packages fall down on data mangement. For example MAXDB (old SAPDB) from MySQL has a limited ODBC driver and no OLEDB driver Would be nice to have to link to dotNet. However you will have to wait for some kind spirited soul to write one, It would take a least 3 months of someone's time. I have heard of people offering to do it for $10,000. Maybe someone will do it at MySQL. Guys who can write this type of code are thin on the ground.

I will content myself to using the PIA-ADODB piece or the ODBC namespace: Microsoft.Data.Odbc. I kinda prefer the PIA-ADODB one as the syntax seems richer. I cant use seem to do something like this (see below) via ODBC namespace in dotnet.

'pseudo sample of referencing a field
' from a recordset/dataset via the fields name

recordSetobj.fields("CustomerName")
Reply With Quote
  #7 (permalink)  
Old August 1st, 2004, 06:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Well DotNet does things differently, so it isn't using the same parameters in the same way. It refers to data as rows/columns, similar to how Excel holds the data.

Brian
Reply With Quote
  #8 (permalink)  
Old August 3rd, 2004, 04:21 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Go here: http://www.connectionstrings.com

And look under MySql and DSN. I realize that you are not using MySql, but there do seem to be some .NET classes developed for MySql connectivity.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 can I work with OLEDB? avaricious programmer SQL Language 0 January 17th, 2007 06:15 PM
Using Jet OLEDB sureshkumarct Visual C++ 0 May 30th, 2006 02:00 AM
oledb or odbc? rupen Classic ASP Databases 2 September 28th, 2005 01:58 AM
How to get adodb.record from adodb.recordset John Pennington Pro VB Databases 1 November 20th, 2004 06:17 AM
Chapter 16 the OLEdb Way? solva VB.NET 2002/2003 Basics 11 February 1st, 2004 04:44 PM



All times are GMT -4. The time now is 11:23 PM.


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