[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

What is wrong with this connectionstring?

TPSoftware

7/30/2002 1:47:00 PM

This connectionstring works fine with ADO, but not with ADO.NET (ODBC.NET is
installed)

Provider=MSDASQL.1;Persist Security Info=False;Data Source=JOF





This is the .NET code:

Private Sub Read()

Dim objConn As OdbcConnection

Dim objCMD As OdbcCommand

Dim objDR As OdbcDataReader

objConn = New OdbcConnection("Provider=MSDASQL.1;Persist Security
Info=False;Data Source=JOF")

objConn.Open()

objCMD = New OdbcCommand("SELECT * FROM core", objConn)

objDR = objCMD.ExecuteReader

While objDR.Read

Debug.WriteLine(objDR(1))

End While

End Sub



Thnx for any help.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.g...).
Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002



5 Answers

Bob Beauchemin

7/30/2002 4:23:00 PM

0

The MSDASQL OLE DB provider (aka the OLE DB provider for ODBC) is not
supported by the OleDb data provider in .NET. You need to use the Odbc data
provider (downloadable from www.microsoft.com/downloads) to work with ODBC
data sources in .NET

Bob Beauchemin
http://staff.develo...


"TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
news:3d467cd2$0$188$ba620e4c@news.skynet.be...
> This connectionstring works fine with ADO, but not with ADO.NET (ODBC.NET
is
> installed)
>
> Provider=MSDASQL.1;Persist Security Info=False;Data Source=JOF
>
>
>
>
>
> This is the .NET code:
>
> Private Sub Read()
>
> Dim objConn As OdbcConnection
>
> Dim objCMD As OdbcCommand
>
> Dim objDR As OdbcDataReader
>
> objConn = New OdbcConnection("Provider=MSDASQL.1;Persist Security
> Info=False;Data Source=JOF")
>
> objConn.Open()
>
> objCMD = New OdbcCommand("SELECT * FROM core", objConn)
>
> objDR = objCMD.ExecuteReader
>
> While objDR.Read
>
> Debug.WriteLine(objDR(1))
>
> End While
>
> End Sub
>
>
>
> Thnx for any help.
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.g...).
> Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002
>
>
>


TPSoftware

7/30/2002 5:47:00 PM

0

>"Bob Beauchemin" <no_bobb_spam@develop.com> schreef in bericht
news:eAGpnS9NCHA.2404@tkmsftngp08...
> You need to use the Odbc data
> provider (downloadable from www.microsoft.com/downloads) to work with ODBC

As you can see from my code I already did,

Even when I do this:
1 - Create a ODBC connection in the ODBC control panel (with Mysql 3.51
driver)
I can connect to this with ADO using this connectionstring for example:
"DSN={mydatabase}"
2- Using ODBC.NET I create a new connection with that connectionstring
"DSN={mydatabase}",
this doesn't work. So I am using ODBC.NET and the MyODBC Driver yet it
doesn't work.

What am I doing wrong ?
TP.


> >"TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
> >news:3d467cd2$0$188$ba620e4c@news.skynet.be...
> > This connectionstring works fine with ADO, but not with ADO.NET
(ODBC.NET
> >is
> > installed)
>>
> > Dim objConn As OdbcConnection
> >
> > Dim objCMD As OdbcCommand
> >
> > Dim objDR As OdbcDataReader
> >

These objects can only be created since I have ODBC.NET installed




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.g...).
Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002


Bob Beauchemin

7/30/2002 7:06:00 PM

0

That should work. I believe in the message I answered, the connection string
had a "provider=MSDASQL" in it. You don't need (and can't use) "provider="
if you are using the Odbc data provider.

Do you need a user ID and password? (its UID= and PWD= in ODBC). These are
not saved normally when you save a DSN.

What is the error that you get back from the Odbc data provider?

Are you using a system DSN or user DSN (system DSNs apply to the whole
system and are usually used in ASP.NET, user DSNs are user specific).

Hope this helps,
Bob Beauchemin
http://staff.develo...



"TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
news:3d46b50e$0$271$ba620e4c@news.skynet.be...
> >"Bob Beauchemin" <no_bobb_spam@develop.com> schreef in bericht
> news:eAGpnS9NCHA.2404@tkmsftngp08...
> > You need to use the Odbc data
> > provider (downloadable from www.microsoft.com/downloads) to work with
ODBC
>
> As you can see from my code I already did,
>
> Even when I do this:
> 1 - Create a ODBC connection in the ODBC control panel (with Mysql 3.51
> driver)
> I can connect to this with ADO using this connectionstring for
example:
> "DSN={mydatabase}"
> 2- Using ODBC.NET I create a new connection with that connectionstring
> "DSN={mydatabase}",
> this doesn't work. So I am using ODBC.NET and the MyODBC Driver yet it
> doesn't work.
>
> What am I doing wrong ?
> TP.
>
>
> > >"TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
> > >news:3d467cd2$0$188$ba620e4c@news.skynet.be...
> > > This connectionstring works fine with ADO, but not with ADO.NET
> (ODBC.NET
> > >is
> > > installed)
> >>
> > > Dim objConn As OdbcConnection
> > >
> > > Dim objCMD As OdbcCommand
> > >
> > > Dim objDR As OdbcDataReader
> > >
>
> These objects can only be created since I have ODBC.NET installed
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.g...).
> Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002
>
>


TPSoftware

7/30/2002 7:58:00 PM

0

Using a system dsn, I'll try your info now
"Bob Beauchemin" <no_bobb_spam@develop.com> schreef in bericht
news:einNht#NCHA.2500@tkmsftngp08...
> That should work. I believe in the message I answered, the connection
string
> had a "provider=MSDASQL" in it. You don't need (and can't use) "provider="
> if you are using the Odbc data provider.
>
> Do you need a user ID and password? (its UID= and PWD= in ODBC). These are
> not saved normally when you save a DSN.
>
> What is the error that you get back from the Odbc data provider?
>
> Are you using a system DSN or user DSN (system DSNs apply to the whole
> system and are usually used in ASP.NET, user DSNs are user specific).
>
> Hope this helps,
> Bob Beauchemin
> http://staff.develo...
>
>
>
> "TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
> news:3d46b50e$0$271$ba620e4c@news.skynet.be...
> > >"Bob Beauchemin" <no_bobb_spam@develop.com> schreef in bericht
> > news:eAGpnS9NCHA.2404@tkmsftngp08...
> > > You need to use the Odbc data
> > > provider (downloadable from www.microsoft.com/downloads) to work with
> ODBC
> >
> > As you can see from my code I already did,
> >
> > Even when I do this:
> > 1 - Create a ODBC connection in the ODBC control panel (with Mysql 3.51
> > driver)
> > I can connect to this with ADO using this connectionstring for
> example:
> > "DSN={mydatabase}"
> > 2- Using ODBC.NET I create a new connection with that connectionstring
> > "DSN={mydatabase}",
> > this doesn't work. So I am using ODBC.NET and the MyODBC Driver yet
it
> > doesn't work.
> >
> > What am I doing wrong ?
> > TP.
> >
> >
> > > >"TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
> > > >news:3d467cd2$0$188$ba620e4c@news.skynet.be...
> > > > This connectionstring works fine with ADO, but not with ADO.NET
> > (ODBC.NET
> > > >is
> > > > installed)
> > >>
> > > > Dim objConn As OdbcConnection
> > > >
> > > > Dim objCMD As OdbcCommand
> > > >
> > > > Dim objDR As OdbcDataReader
> > > >
> >
> > These objects can only be created since I have ODBC.NET installed
> >
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.g...).
> > Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002
> >
> >
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.g...).
Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002


TPSoftware

7/30/2002 8:35:00 PM

0

An unhandled exception of type 'Microsoft.Data.Odbc.OdbcException' occurred
in microsoft.data.odbc.dll

Additional information: System error.

This is what I get with this code:
objConn = New OdbcConnection("DSN={JOF}")

objConn.Open()






"Bob Beauchemin" <no_bobb_spam@develop.com> schreef in bericht
news:einNht#NCHA.2500@tkmsftngp08...
> That should work. I believe in the message I answered, the connection
string
> had a "provider=MSDASQL" in it. You don't need (and can't use) "provider="
> if you are using the Odbc data provider.
>
> Do you need a user ID and password? (its UID= and PWD= in ODBC). These are
> not saved normally when you save a DSN.
>
> What is the error that you get back from the Odbc data provider?
>
> Are you using a system DSN or user DSN (system DSNs apply to the whole
> system and are usually used in ASP.NET, user DSNs are user specific).
>
> Hope this helps,
> Bob Beauchemin
> http://staff.develo...
>
>
>
> "TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
> news:3d46b50e$0$271$ba620e4c@news.skynet.be...
> > >"Bob Beauchemin" <no_bobb_spam@develop.com> schreef in bericht
> > news:eAGpnS9NCHA.2404@tkmsftngp08...
> > > You need to use the Odbc data
> > > provider (downloadable from www.microsoft.com/downloads) to work with
> ODBC
> >
> > As you can see from my code I already did,
> >
> > Even when I do this:
> > 1 - Create a ODBC connection in the ODBC control panel (with Mysql 3.51
> > driver)
> > I can connect to this with ADO using this connectionstring for
> example:
> > "DSN={mydatabase}"
> > 2- Using ODBC.NET I create a new connection with that connectionstring
> > "DSN={mydatabase}",
> > this doesn't work. So I am using ODBC.NET and the MyODBC Driver yet
it
> > doesn't work.
> >
> > What am I doing wrong ?
> > TP.
> >
> >
> > > >"TPSoftware" <tpsoftware@users.sourceforge.net> wrote in message
> > > >news:3d467cd2$0$188$ba620e4c@news.skynet.be...
> > > > This connectionstring works fine with ADO, but not with ADO.NET
> > (ODBC.NET
> > > >is
> > > > installed)
> > >>
> > > > Dim objConn As OdbcConnection
> > > >
> > > > Dim objCMD As OdbcCommand
> > > >
> > > > Dim objDR As OdbcDataReader
> > > >
> >
> > These objects can only be created since I have ODBC.NET installed
> >
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.g...).
> > Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002
> >
> >
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.g...).
Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002