Solved

sqlclient connection

Posted on 2006-10-28
3
617 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

15 Experts available now in Live!

Get 1:1 Help Now