Dear all
i wrote one class to deal with sql database to insert and read data from that class only...and based on that one of the parmeters or the class is the sqlconnection
SqlConnection connection = new SqlConnection(@ "Data Source=.\SQLEXP RESS;AttachDbFi lename= {0};Integrated Security=True;C onnect Timeout=30;User Instance=True") ;
so the connection string is defined indepented of the class objects of the class (i mean class objects used by the other class)
but I need to change the database file or I want to change the connection string
so how can I change the connection string for the whole class ...
What I did
i define the connection in the beginning of the class
SqlConnection connection = new SqlConnection() ;
then I wrote a method
public void conntstr(string r)
{
connection = new SqlConnection(r );
}
and I passed the connection string to it...however it doesn't worte?
what can I do