Re: SQL Server 2005 connection from VB.NET 2003
- From: "Ginny Caughey [MVP]" <ginny.caughey.online@xxxxxxxxxxxxxx>
- Date: Mon, 22 Oct 2007 08:03:40 -0400
Andy,
You can still use integrated security, but you have to provide the domainName\userName and password in the connection string. Also make sure you have tcp/ip enabled for your SQL 2005 server for accessing via ip address.
--
Ginny Caughey
Device Application Development MVP
"Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx> wrote in message news:13hp2shhrt50l7f@xxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxxHere 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@xxxxxxxxxxxxxxxxxxxxxOur 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: Andy Baker
- 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
- Re: SQL Server 2005 connection from VB.NET 2003
- From: Andy Baker
- SQL Server 2005 connection from VB.NET 2003
- Prev by Date: Re: SQL Server 2005 connection from VB.NET 2003
- Next by Date: Re: Windows Media Player for CE5 and Media Player Series 9
- 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
|