Re: SQL Server 2005 connection from VB.NET 2003



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








.



Relevant Pages

  • RE: SBS 2003 SP1 Upgrade - MSDE 2000 Service Pack 4 did not instal
    ... The DSRestore Filter failed to connect to local SAM server. ... registry keys of the Microsoft SQL server and mail to me for analyze. ... This newsgroup only focuses on SBS technical issues. ... SBS 2003 SP1 Upgrade - MSDE 2000 Service Pack 4 did not install ...
    (microsoft.public.windows.server.sbs)
  • RE: How do I get back to base SQL server on my SBS 2003 server?
    ... Can I reinstall the files from another SBS2003 server I manage? ... On my install of SLQ2005, I told it to upgrade all instances. ... Installing SQL Server 2005 WorkGroup Edition in Windows Small Business ... <The server-based applications that were running fine are: McAFee EPO, ...
    (microsoft.public.windows.server.sbs)
  • Re: Installed VS 2005 want to Manage SQL 2005 Server
    ... I Guess I didn't copy it to the Install Source on the Server. ... To change an existing instance of Microsoft SQL Server 2005 to a different edition of SQL Server 2005, you must run SQL Server 2005 Setup from the command prompt and include the SKUUPGRADE=1 parameter. ... The Following Components that you chose to install are already installed onthe machine. ...
    (microsoft.public.sqlserver.setup)
  • Re: Clearer version of my earlier question re sp_grantlogin and sp_grantdbaccess
    ... > Server, doesn't have the right to grant DB access to Domain Groups. ... I didn't know that an SQL Server login as ... > I did the install about a month ago as Domain Admin (default install - mixed ... > site where they let me login as Domain Admin. ...
    (microsoft.public.sqlserver.msde)
  • Re: cannot connect to server - using SMO and web serivce
    ... Here is the entire error string, It is a WCF error, but it only seems to ... Message="Failed to connect to server CHITEST01." ... button, Int32 clicks) ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (microsoft.public.sqlserver.programming)

Loading