• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 632
  • Last Modified:

sqlclient connection

I have c# 2005 and I plan on connecting to a sql 2000 database. What is the best performance\reliablity connection string and how should it work.

I am use to using the odbc but it would be nice to see what others are using with the new version plus eliminating the slow speed and having to create an odbc on clients pcs that will be using the application.

the applications will be used internally and possibly users at home connecting via a vpn connection.

0
bman9111
Asked:
bman9111
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
You should stick to the SqlConnection, etc, objects because they use the native Sql Server drivers and are much faster than the Odbc and OleDb equivalents.
0
 
bman9111Author Commented:
could you provide some coding please?
0
 
Carl TawnSystems and Integration DeveloperCommented:
In it simplest format:

    SqlConnection cn = new SqlConnection("Server=YourServerName;UID=aUser;PWD=aPassword;Initial Catalog=YourDatabase;");              // Using SQL Authentication

    SqlConnection cn = new SqlConnection("Server=YourServerName;Integrated Security=SSPI;Initial Catalog=YoruDatabase;");                   // Using windows authentication

The rest of your code would be the same as it is for Odbc, only the object type changes.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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