Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I have add " System.Data.SqlClient "
on every aspx code behind file ( Partial Classes )
 
Is it Possible to add it only 1 time to use throughout the project ??
 

thanks
Posted 20-Jan-12 1:10am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You are confusing two things here. Adding a reference is only done once for each project of a solution. What you meant was adding the using (C#) clause (import for the VB.NETers). This needs to be added to each and every file where you are trying to use a certain package.
 
Regards,
 
Manfred
  Permalink  
Comments
Tech Code Freak at 20-Jan-12 6:34am
   
5up!
Very true!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello,
 
You need to add the reference on each and every page, it doesnt allow only one time in project.
 
It is possible that you can create one class and put the reference one time and then create a object of that class and access the methods
 

can try this
  Permalink  
Comments
Tech Code Freak at 20-Jan-12 6:48am
   
5up for the class!
qasimidl at 23-Jan-12 5:06am
   
thanks
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Do one thing create a separate layer for data access , where u need to add reference of the SQLClient,
And take this advantage to your project
  Permalink  
Comments
qasimidl at 23-Jan-12 5:06am
   
thanks
can you please give me sample code ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 20 Jan 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100