Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ADODB on dotnet.

48 views
Skip to first unread message

Mr. X.

unread,
Oct 13, 2008, 8:00:05 AM10/13/08
to
Hello.

In earlier applications I did :
Dim conn As Adodb.connetion

... in order to declare a connection string (rest is known).

When I am using dotnet (In VISUAL STUDIO 2008),

The above isn't compiled.

On the aspx page :

...

<

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb"
Inherits="WebApplication1._Default" %>

in Default.aspx.vb :

==============

Partial Public Class _Default

Inherits System.Web.UI.Page

Dim conn As Adodb.connetion

Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As
EventArgs)

End Sub

End Class

"Dim conn As Adodb.connetion" is not the correct syntax.

What is the correct syntax ?

Is there any other way to do connection to database (fits to sql-server
2008) ?

Thanks :)


Chuck

unread,
Oct 13, 2008, 8:42:42 AM10/13/08
to
For SQL you can look at the System.Data.SqlClient namespace

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx

You can also look at the factory classes, which will allow your app (with a
little careful consideration) to connect to different types of databases
depending on configuration.

http://www.developer.com/net/net/article.php/3504146

Chuck
"Mr. X." <no_spam_please@nospam_please.com> wrote in message
news:%23n8xZsS...@TK2MSFTNGP06.phx.gbl...

Armin Zingler

unread,
Oct 13, 2008, 8:22:49 AM10/13/08
to
"Mr. X." <no_spam_please@nospam_please.com> schrieb

> "Dim conn As Adodb.connetion" is not the correct syntax.
>
> What is the correct syntax ?

Did you set a reference to the library containing that class?


> Is there any other way to do connection to database (fits to sql-server
> 2008) ?

http://msdn.microsoft.com/en-us/library/ms254507.aspx


Armin

Mr. X.

unread,
Oct 13, 2008, 9:02:20 AM10/13/08
to
How can I set a reference to the library ?

Thanks :)


kimiraikkonen

unread,
Oct 13, 2008, 9:13:36 AM10/13/08
to
On Oct 13, 4:02 pm, "Mr. X." <no_spam_please@nospam_please.com> wrote:
> How can I set a reference to the library ?
>
> Thanks :)

In Solution Explorer, right click on your project -> "Add Reference"
then choose necessary tab, in this case, from .NET tab, choose
System.Data.dll.

Hope this helps,

Onur Güzel

Mr. X.

unread,
Oct 13, 2008, 9:11:31 AM10/13/08
to
Found.

(Right click on project name + add reference + ADO)

It's a question for newbie user of Microsoft Visual Studio 2008.
(Still looking for good tutorial for M VS.2008).

Thanks anyway :)


Armin Zingler

unread,
Oct 13, 2008, 9:14:59 AM10/13/08
to
"Mr. X." <no_spam_please@nospam_please.com> schrieb

> How can I set a reference to the library ?
>
> Thanks :)

http://msdn.microsoft.com/en-us/library/wkze6zky.aspx


Armin

Michel Posseth [MCP]

unread,
Oct 13, 2008, 10:55:20 AM10/13/08
to
Mr X

It is clear to me that you use classic ADODB syntax while in the .Net world
we use ADO.Net

Please read a bit about the subject ADO.Net as the next thing you are going
to miss is the recordset object
now in ADO.Net we have Datasets wich can exist out of one or more DataTables
a Datatables is the modern vaiant of of recordset object
a DataTable exists out of DataRows wich in its turn exists out of
DataColumns .


Also note the Disconnected aproach of ADO.Net ,,, VS the choices you had to
choose at ADODB,,, a datareader ( the thingy that fills the dataset in
ADO.Net )
is simular to a firehose cursor in classic ADO etc etc etc etc etc etc .


I would recomend you to read a good ADO.Net Book

http://astore.amazon.com/vbdotnetcoder-20?%5Fencoding=UTF8&node=9

Michel Posseth [MCP]
http://www.vbdotnetcoder.com


"Mr. X." <no_spam_please@nospam_please.com> schreef in bericht
news:%23n8xZsS...@TK2MSFTNGP06.phx.gbl...

Cor Ligthert[MVP]

unread,
Oct 14, 2008, 6:58:24 AM10/14/08
to
Hi,


Dim myConnection As New ADODB.Connection
MyConnection.ConnectionString = "Provider='sqloledb';Data
Source='MySqlServer';" & _
"Initial Catalog='Pubs';Integrated Security='SSPI';"


Cor

"Mr. X." <no_spam_please@nospam_please.com> schreef in bericht
news:%23n8xZsS...@TK2MSFTNGP06.phx.gbl...

Michel Posseth [MCP]

unread,
Oct 14, 2008, 1:29:32 PM10/14/08
to
Mr. X.

What i am still curious about is the following

I see all these people here giving you answers how to use "Classic" ADODB in
.Net 2008 ( wich i would sure not recomend you to do unless you have a
verry good reasson to do so

Are you aware of the fact that ADO.Net should be prefered in .Net ?

regards

Michel

"Mr. X." <no_spam_please@nospam_please.com> schreef in bericht
news:%23n8xZsS...@TK2MSFTNGP06.phx.gbl...

Mr. X.

unread,
Oct 14, 2008, 6:46:18 PM10/14/08
to
Hello.
If ADO.NET is better choice for modern programming,
so I shall use it.

There is also application-box - is it related to ADO.NET.

What classic thing to do is :
using adodb.connection, and open it with a connectionString.
set a recordset by some pure sql : ado.recordSet rs =
connection.ExecuteQuery( sql ...)
do some rs.getNext until rs.eof.
close rs and connection.

What may be difference between ADO.NET & ADO ?
What are the stages of ADO.NET ?

No need much answer,
because I just got confused from VS 2008, and need some practice on it.
Problem has been solved since I add reference to ADO.

Thanks :)


Cor Ligthert[MVP]

unread,
Oct 15, 2008, 1:39:04 AM10/15/08
to
Because probably noboby including me, wants to answer again on that dead
horse again

As it is a question about AdoDB then you don't by instance know if this is
related with Sharepoint, where was AFAIK a time written by some people like
the about the dispose method.

"It is best practise to use ADODB". About the Dispose this is changed on the
official MSDN pages, I am not aware about the status with AdoDB.

Cor


"Michel Posseth [MCP]" <MS...@posseth.com> wrote in message
news:ujuQbJiL...@TK2MSFTNGP02.phx.gbl...

Michel Posseth [MCP]

unread,
Oct 15, 2008, 1:27:23 PM10/15/08
to
Huh ???

> Because probably noboby including me, wants to answer again on that dead
> horse again

And then you start giving wrong answers ? , and i was having the impression
that his question was misunderstood by the rest of the thread answerers
that is why i gave this thread a new push with my question

> As it is a question about AdoDB then you don't by instance know if this is
> related with Sharepoint, where was AFAIK a time written by some people
> like the about the dispose method.
>
> "It is best practise to use ADODB". About the Dispose this is changed on
> the official MSDN pages, I am not aware about the status with AdoDB.
>

Wel after rereading this several times , i am still not sure if i understand
you correct

but i give it a shot :

>As it is a question about AdoDB then you don't by instance know if this is
>related with Sharepoint,

I guess he should have posted his question then in one of the sharepoint
related groups or at least mention sharepoint or any other valid reasson for
using legacy ADODB in .Net

>"It is best practise to use ADODB". About the Dispose this is changed on
>the official MSDN pages, I am not aware about the status with AdoDB.

AFAIK : the prefered way in .Net languages to access data and data
services is ADO.Net and not ADODB
it as simple as ADO.Net = .Net and ADODB = legacy So if you program in
.Net wich one should be prefered ?

And Dispose why are you still talking about the Dispose thread ?
The book i quoted out was published in 2002 about the same time when VB.Net
was released to the public , so from my perspective the Dispose rule is as
old as .Net is out there .


Michel Posseth [MCP]
http://www.vbdotnetcoder.com

"Cor Ligthert[MVP]" <Notmyfi...@planet.nl> schreef in bericht
news:%23J1ZUho...@TK2MSFTNGP06.phx.gbl...

Michel Posseth [MCP]

unread,
Oct 15, 2008, 1:59:57 PM10/15/08
to
Hello Mr. X

ADO.Net is the bether choice for all .Net languages unless you have a valid
reasson to stick with ADO classic
i now for a fact that some programmers still use ADO classic just because
they use the ADOX features in there programs
however the same can be acomplished with ADO.Net and some DDL SQL .

here is a good ADO.Net reference

http://msdn.microsoft.com/nl-nl/data/aa937722(en-us).aspx

> What classic thing to do is :
> using adodb.connection, and open it with a connectionString.
> set a recordset by some pure sql : ado.recordSet rs =
> connection.ExecuteQuery( sql ...)
> do some rs.getNext until rs.eof.
> close rs and connection.

the ADO.Net equivalant would be something like this

Imports System.Data.SqlClient

Public Class Form1

Private Sub test()

Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"

'standard : Data Source=myServerAddress;Initial Catalog=myDataBase;User
Id=myUsername;Password=myPassword;

'Trusted : Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated
Security=SSPI;

Using myConnection As New SqlConnection("Data Source=myServerAddress;Initial
Catalog=myDataBase;Integrated Security=SSPI;")

Dim myReader As SqlDataReader

Using myCommand As New SqlCommand(mySelectQuery, myConnection)

myConnection.Open()

myReader = myCommand.ExecuteReader()

End Using

' Always call Read before accessing data.

While myReader.Read()

Debug.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1)))

End While

' always call Close when done reading.

myReader.Close()

' Close the connection when done with it.

myConnection.Close()

End Using

End Sub

End Class

> What may be difference between ADO.NET & ADO ?
> What are the stages of ADO.NET ?

http://msdn.microsoft.com/en-us/library/904fck4k(VS.80).aspx

http://en.wikipedia.org/wiki/ADO_vs_ADO.NET


I recomend you to read in on the subject it is not so hard , buy yourself
some good MS PRESS books


regards

Michel Posseth [MCP]
http://www.vbdotnetcoder.com

"Mr. X." <no_spam_please@nospam_please.com> schreef in bericht

news:%234YUK6k...@TK2MSFTNGP05.phx.gbl...

Cor Ligthert[MVP]

unread,
Oct 16, 2008, 1:38:00 AM10/16/08
to
Michel,

First: I agree that my previous message had a lot of grammatical failures. I
corrected it to quick, while in fact I had no time at that moment (like in
fact now).

Second: As advice, buy a new book, books from 2002 where based on Beta
2002 VB, while even the not Beta VB 2002 was very bad.
In that time is often used the sentence "It is best practise
.........................", simple because the mostly VB6 writers who were
converting there books did not understand things yet. This sentence exist as
well for AdoDB, however probably that is from before the .Net time and meant
that AdoDB was better than DOA. Those best practise sentences seem to have
mostly almost an endless life.

Thirth: although I never use it, can AdoDB be a better choise to use for
application made solely for stand alone, by instance games, simply because
in those cases AdoDB is much quicker (DAO is even quicker but that is not
supported anymore).

Fourth: AdoDb has still to be supported for a while, because it is still in
Visual Studio .Net 2008, because AdoDB is used by converting VB6 programs.

Cor


"Michel Posseth [MCP]" <MS...@posseth.com> wrote in message

news:u1OpesuL...@TK2MSFTNGP05.phx.gbl...

Michel Posseth [MCP]

unread,
Oct 16, 2008, 2:22:46 AM10/16/08
to
Cor ,

> Second: As advice, buy a new book, books from 2002 where based on Beta
> 2002 VB, while even the not Beta VB 2002 was very bad.
> In that time is often used the sentence "It is best practise
> .........................", simple because the mostly VB6 writers who were
> converting there books did not understand things yet. This sentence exist
> as well for AdoDB, however probably that is from before the .Net time and
> meant that AdoDB was better than DOA. Those best practise sentences seem
> to have mostly almost an endless life.

no no no no , the book i am talking about is the core reference guide , it
is even updated today ( downloadable from the writers website ) with new
insights etc etc etc there is also a revisited 2005 version same story there
.

so you are now telling me that all official MS Press books are wrong , that
the MSDN library is wrong ,that our peers who agree are wriong , etc etc
etc you are kidding me are you ? , There is nothing beta or even
misinformation in the core reference guides you are talking about the
"Introducing " series of MS press wich this book is obviously not MS Press
has "Introducing" , "Step by Step", "Core Reference" , and "Advanced
Topics"

I only quote from Core Reference and Advanced Topics versions of the MS
press Books they are not based on beta`s and for a fact verry wel written i
can indeed not say the same for the "Introducing" and "Step by Step"Books
although they serve there purpose i comonly find flaws in them .

For the rest of your dialogue , this is really beating death horses ,talk
facts,,, simple question do you believe that it is completely normall to do
standard database stuff with ADODB in a brand new VB.net 2008 application
?? i don`t think so ,, so i guess we are on the same line again .

Cause that is where this thread was all about , not that it can and could or
whatever,,,,,, ofcourse this is a famous thing for Dutch people talking
everything straight that is bended as a curve ,,, telling a person that
black is actually white with some other color variations added to it

Not so verry long ago i was even atacked in this group by people who think
it is common practice to use DAO in brand new VB.Net apps so the long story
made short is ( i have to go to work now ) "Just because you can" ,
"doesn`t mean you should" .

regards

Michel Posseth

"Cor Ligthert[MVP]" <Notmyfi...@planet.nl> schreef in bericht

news:eydCOG1L...@TK2MSFTNGP04.phx.gbl...

Cor Ligthert[MVP]

unread,
Oct 16, 2008, 12:07:50 PM10/16/08
to
Michel,

I stop this discussion, mostly we agree and I don't want to disturb that by
this kind childness discussions (for sure by me).

However, as advice don't write this, "ofcourse this is a famous thing for

Dutch people talking everything straight that is bended as a curve "

Not everybody on Internet knows that you are as well Dutch so it can be seen
as discriminating (or whatever) Dutch people, beside that, I have more than
often showed in the newsgroups that my behaviour is oposite from that.

-:)

Cor

Michel Posseth [MCP]

unread,
Oct 16, 2008, 1:38:28 PM10/16/08
to
Cor ,

"We all come in different SHAPES and SIZES.
We all have STRENGTHS and weaknesses.

What's right for one person may not be right for another.
There are things that are important to me, that you don't care about at
all!
And sometimes your behavior doesn't make any sense to me.

But I want for us to understand each other, and communicate well,
because we live together in the same world.

I know I can't expect you to want the same things that I want.
We are not the same person, so we will not always see things the same way.

I have my own Thoughts and my own Ideas,
that may or may not fit into your vision of who I should be. "

Above is copied and pasted from a personalitypage but it reflects my
feelings regarding discussions like this
i believe that with a litle inmagination to reflect it on this group it
says it all .

Regards


Michel Posseth [MCP]
http://www.vbdotnetcoder.com


"Cor Ligthert[MVP]" <Notmyfi...@planet.nl> schreef in bericht

news:%23jR1Vl6...@TK2MSFTNGP03.phx.gbl...

0 new messages