[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

Connection string in vb.net vs C sharp

I have the following connection string in c#. what will be its equivalent in vb.net
@"SERVER=GAATLENDCTU123W\SQLEXPRESS; Initial Catalog=Test;Integrated Security=SSPI ";
0
AbebeDemeke
Asked:
AbebeDemeke
  • 2
2 Solutions
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
You can use:

Provider=SQLNCLI;Server=GAATLENDCTU123W\SQLEXPRESS;Database=Test;Trusted_Connection=yes;

Complete set of options below:

http://www.connectionstrings.com/sql-server-2005
0
 
YZlatCommented:
same thing in VB.NET except you won't need @ escape character in front of the string:

dim strConn="SERVER=GAATLENDCTU123W\SQLEXPRESS; Initial Catalog=Test;Integrated Security=SSPI " 
0
 
YZlatCommented:
also I'd suggest changing your connection string to the following:

"Data Source=GAATLENDCTU123W\SQLEXPRESS;Initial Catalog=Test;Integrated Security=SSPI;"

dim strConn as string="Data Source=GAATLENDCTU123W\SQLEXPRESS;Initial Catalog=Test;Integrated Security=SSPI;"
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now