Thank, both of you are right.
Last time when I tested it, I was using a microsoft sample project.
"William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
news:%23loqjeWZGHA.3524@TK2MSFTNGP04.phx.gbl...
>
> I just tried it in code in a virgin Visual Studio Express setup here. It
> works fine. Again, the Visual Studio IDE won't let you setup a Database
> Explorer connection to external data sources but you can connect in code.
> Did you add an Imports System.Data.SqlClient?
>
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
>
www.betav.com/blog/billva >
www.betav.com > Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> __________________________________
>
> "M" <mxchen@hotvoice.com> wrote in message
> news:%23r0dZXVZGHA.4884@TK2MSFTNGP02.phx.gbl...
> >
> > Yes.I did both
> > the declare statements do not have problem. but VBEXPRESS ignore them.
> > I think Microsoft do not want the free software to do to much thing.
> >
> >
> >
> > "William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
> > news:O6pW0B1YGHA.1192@TK2MSFTNGP04.phx.gbl...
> >>
> >> did you import the system.data.sqlclient DLL or add a reference to the
> >> ADODB.DLL?
> >>
> >> --
> >> ____________________________________
> >> William (Bill) Vaughn
> >> Author, Mentor, Consultant
> >> Microsoft MVP
> >> INETA Speaker
> >>
www.betav.com/blog/billva > >>
www.betav.com > >> Please reply only to the newsgroup so that others can benefit.
> >> This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >> __________________________________
> >>
> >> "M" <mxchen@hotvoice.com> wrote in message
> >> news:eKyXBPzYGHA.1196@TK2MSFTNGP03.phx.gbl...
> >> >
> >> > Thanks
> >> >
> >> > Actually the VB 2005 express Set 'Just my code' enabled and no way to
> >> > change.
> >> > If I declare
> >> > Dim cn as New adodb.connection()
> >> > or
> >> > Dim cn as New SQLClient.sqlconnection(ConStr)
> >> > None of them Allow me add the statement
> >> > cn.open .
> >> > The message is declaration expected. ALthough I declare it just one
> >> > line
> >> > ahead
> >> >
> >> >
> >> >
> >> > "Paul Clement" <UseAdddressAtEndofMessage@swspectrum.com> wrote in
> > message
> >> > news:qf9a4256p8e4aeooteccrc78tsictfmkdb@4ax.com...
> >> >> On Tue, 18 Apr 2006 09:02:31 -0700, "Chen" <mxchen100@hotmail.com>
> > wrote:
> >> >>
> >> >> ¤
> >> >> ¤ If I try add a connection in database Explorer
> >> >> ¤
> >> >> ¤ On database Explorer
> >> >> ¤ I select "Add connection"
> >> >> ¤ The Choose DataSource screen appear.
> >> >> ¤ It alway assunme to connect to SQL server 2005
> >> >> ¤ and let you select a MDF file.
> >> >> ¤
> >> >> ¤ After locate a MDF file and click test connection I get the error
> >> > message:
> >> >> ¤ An error has occured while establishing a connection to the
server.
> >> >> When
> >> >> ¤ connecting to SQL Server 2005, this failure may be caused by the
> >> >> fact
> >> > that
> >> >> ¤ under the daufault setting SQL Server does not allow remote
> > connections
> >> >> ¤ (provider: SQL Newwork interfaces, error:25 - connection string is
> > not
> >> >> ¤ valid)
> >> >> ¤ Actually my SQL server 2005 database Engine set to using both
TCP/IP
> >> >> and
> >> >> ¤ named pipes,
> >> >> ¤ allow remote connection.
> >> >>
> >> >> Bill is correct. The GUI data tools in the Express Editions only
> > support
> >> > local databases. If you use
> >> >> the ADO.NET libraries instead it works just fine.
> >> >>
> >> >>
> >> >> Paul
> >> >> ~~~~
> >> >> Microsoft MVP (Visual Basic)
> >> >>
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >
> >
> >
>
>
>