?
Solved

sqlclient connection

Posted on 2006-10-28
3
Medium Priority
?
630 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

771 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