Solved

sqlclient connection

Posted on 2006-10-28
3
619 Views
Last Modified: 2008-03-06
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
Comment
Question by:bman9111
  • 2
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17826440
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
 
LVL 8

Author Comment

by:bman9111
ID: 17826500
could you provide some coding please?
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 17826508
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
String manipulation 15 64
Loop not working 29 47
SQL Query Producing decimal places when it shouldn;t be 8 35
Web Form VB.Net  import CSV 4 21
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now