Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Declaring a connection string in class file Pin
Shameel14-Aug-12 1:49
professionalShameel14-Aug-12 1:49 
GeneralRe: Declaring a connection string in class file Pin
Pete O'Hanlon14-Aug-12 2:02
mvePete O'Hanlon14-Aug-12 2:02 
GeneralRe: Declaring a connection string in class file Pin
Member 925960614-Aug-12 2:20
Member 925960614-Aug-12 2:20 
GeneralRe: Declaring a connection string in class file Pin
Pete O'Hanlon14-Aug-12 2:40
mvePete O'Hanlon14-Aug-12 2:40 
GeneralRe: Declaring a connection string in class file Pin
Member 925960614-Aug-12 2:53
Member 925960614-Aug-12 2:53 
GeneralRe: Declaring a connection string in class file Pin
Shameel14-Aug-12 4:13
professionalShameel14-Aug-12 4:13 
GeneralRe: Declaring a connection string in class file Pin
Pete O'Hanlon14-Aug-12 4:34
mvePete O'Hanlon14-Aug-12 4:34 
AnswerRe: Declaring a connection string in class file Pin
Simon_Whale13-Aug-12 4:35
Simon_Whale13-Aug-12 4:35 
Firstly I would have a look here so that you can construct your connection string[^]

then I can only assume that you are after declaring a string variable that you can use through out your class, so then I would look at this

C#
public class myDatabaseClass
{
 private string _ConnectionString = "my database string here";

 ///That can then be used by any of the methods in the class such this
 public void ShowString()
 {
    Debug.Print(_ConnectionString);
 }
}


Myself personally I prefer to use the AppConfig to store such changeable information as its easier to change without having to recompile and distrubite the application again.

I would have a read of this as it will give you a start : Configuring a Connection String in the App.Config File During Runtime in C#[^]

I know it is for Visual Studio 2010 but it will give you the general idea.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

AnswerRe: Declaring a connection string in class file Pin
Vijay Selvaraj26-Aug-12 22:10
Vijay Selvaraj26-Aug-12 22:10 
Questionin C#.net [moved] Pin
Member 925960613-Aug-12 2:56
Member 925960613-Aug-12 2:56 
GeneralRe: in C#.net PinPopular
chriselst13-Aug-12 3:01
chriselst13-Aug-12 3:01 
GeneralRe: in C#.net Pin
V.13-Aug-12 3:04
professionalV.13-Aug-12 3:04 
GeneralRe: in C#.net Pin
JimmyRopes13-Aug-12 3:10
professionalJimmyRopes13-Aug-12 3:10 
GeneralRe: in C#.net Pin
V.13-Aug-12 3:14
professionalV.13-Aug-12 3:14 
GeneralRe: in C#.net Pin
NormDroid13-Aug-12 3:09
professionalNormDroid13-Aug-12 3:09 
JokeRe: in C#.net Pin
Joan M13-Aug-12 3:13
professionalJoan M13-Aug-12 3:13 
GeneralRe: in C#.net Pin
fjdiewornncalwe13-Aug-12 3:14
professionalfjdiewornncalwe13-Aug-12 3:14 
GeneralRe: in C#.net Pin
Pete O'Hanlon13-Aug-12 3:14
mvePete O'Hanlon13-Aug-12 3:14 
GeneralRe: in C#.net Pin
Joan M13-Aug-12 3:13
professionalJoan M13-Aug-12 3:13 
Questionusing Same Shortcut keys on Different Tabs of a form Pin
Why so Serious13-Aug-12 2:48
Why so Serious13-Aug-12 2:48 
AnswerRe: using Same Shortcut keys on Different Tabs of a form Pin
Shameel13-Aug-12 4:29
professionalShameel13-Aug-12 4:29 
AnswerRe: using Same Shortcut keys on Different Tabs of a form Pin
Liam Cairns Kelly13-Aug-12 9:30
Liam Cairns Kelly13-Aug-12 9:30 
Questionread and org data in c# Pin
Xarzu12-Aug-12 23:42
Xarzu12-Aug-12 23:42 
AnswerRe: read and org data in c# Pin
Eddy Vluggen13-Aug-12 0:33
professionalEddy Vluggen13-Aug-12 0:33 
QuestionOverriding the DefaultValueAttribute of an inherited property Pin
Bernhard Hiller12-Aug-12 20:51
Bernhard Hiller12-Aug-12 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.