Re: SQL Server 2005 connection from VB.NET 2003
- From: "Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Oct 2007 12:42:57 +0100
Thanks for the reply. That's more or less what I'm doing, except with an IP
address instead of the server name. I have tried using the server name and
still get the same problem. What method of security are you using on the SQL
Server 2005 database? I have using integrated security for the network PC,
but have set up a user name and password for the CE device. This worked with
SQL Server 2000, but I'm wondering if this is the problem with 2005.
Andy Baker
"Ron Weiner" <rweineratworksritedotcom> wrote in message
news:eNxGkfqEIHA.5976@xxxxxxxxxxxxxxxxxxxxxxx
Here is the Function we use to connect our VS2003 VB.Net CF1.0 app to a
Varity of SqlExpress 2005 Databases. Can't imagine that it won't work
with it's big brother.
Public Function GetRemoteSqlDBConnectStr(ByVal strExtServerName As String,
ByVal strExtDbName As String) As String
' Purpose Returns the connect string for the remote Sql Database
Return "Server=" & strExtServerName & "; " _
& "Database=" & strExtDbName & "; Connect Timeout=10;" _
& "User ID=UserLogin; Password=PassWord;"
End Function
Been working for a couple years with named (not IP address) servers.
Typical Calling code"
Dim cn As New SqlConnection
cn.ConnectionString = GetRemoteSqlDBConnectStr("MyServer", "MyDatabase")
cn.Open()
' Do Stuff...
cn.Close
cn = Nothing
Ron W.
"Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx> wrote in message
news:13hgvova0dh77ef@xxxxxxxxxxxxxxxxxxxxx
Our application is written in VB.NET 2003 and uses SQL Server 2000. We
have a customer who wants to upgrade SQL Server 2005, so I recently
installed the developer edition to check whether it worked with our
application. I changed the connection string on the PC application to
point to the new instance of SQL server, and to my surprise it worked and
connected to 2005 without any changes in code. However when I made the
same changes on the application that accesses SQL server from CE.NET
devices, it didn't and I get the error message 'SQL server does not exist
or access denied'. The code that I am using is:
Dim cn as SqlConnection
cn = New SqlConnection("Data Source=xxx.xxx.xxx.xxx; Initial
Catalog=Vanputer; User Id=****; Password=****")
cn.Open
where the IP address is the address of the PC where SQL Server 2005 is
installed, Vanputer is name of the database in SQL Server 2005, and User
Id and Password are set up as a user in SQL Server 2005. All I have done
has changed the IP address from the server where SQL Server 2000 is
installed to the one where 2005 is installed, backed up the database from
2000 and restored to 2005. My questions are:
1) Is it possible to connect to SQL Server 2005 from VB.NET 2003 and
compact framework 1.1 or do I have to use VB.NET 2005?
2) If it is possible, what else am I doing wrong? Do I have to install
anything else on the PC where 2005 is installed to allow access from CE
devices, or can I change the connection string / use ODBC instead of
SqlConnection?
Thanks in advance
Andy Baker
.
- Follow-Ups:
- Re: SQL Server 2005 connection from VB.NET 2003
- From: Ginny Caughey [MVP]
- Re: SQL Server 2005 connection from VB.NET 2003
- References:
- SQL Server 2005 connection from VB.NET 2003
- From: Andy Baker
- Re: SQL Server 2005 connection from VB.NET 2003
- From: Ron Weiner
- SQL Server 2005 connection from VB.NET 2003
- Prev by Date: MSMQ on remote machine
- Next by Date: Re: SQL Server 2005 connection from VB.NET 2003
- Previous by thread: Re: SQL Server 2005 connection from VB.NET 2003
- Next by thread: Re: SQL Server 2005 connection from VB.NET 2003
- Index(es):
Relevant Pages
|
Loading