Hi all,
I have develop one windows application where i am using sql server 2000 database as a backend. i have created database on server machine and i am developing the application on Development machine using VS 2005, now my problem is whenever i run the application it get's stuck on connection.open statement and it takes planty of time to connect and get the data from server database, where as when i kept the database on development machine it is working fine and quickly , please tell me that how can i reduce the time taken by the applicatiion to connect to server and fetching the data from server database, can we develop such client server application in c# windows application or i have to create web application for the same.
thank u in advance
Suchit KhannaPosted May 26, 2009, 9:15 AM
AnantPosted May 26, 2009, 3:54 AM
my code for retriving data is
public
static string str = "Data Source=SERVER;Connection Timeout = 60;Initial Catalog=PLMFileTracker;Integrated Security=True";public SqlConnection cn = new SqlConnection(str); // this is the connection string to connect to my sqlserver database on server machine
//code to access and retrive data is as follows
string
Findme = "my select command";SqlCommand
cmdfinddt= new SqlCommand(Findme, cn); try{
cn.Open();
SqlDataReader dr = cmdfinddt.ExecuteReader();while(dr.Read())
{
//add the data into combo box
combobox1.Items.Add(dr[0].ToString());
}
dr.Close();
}
catch()
{
messagebox.show("Error");
}
finally
{
cn.close();
}
Suchit KhannaPosted May 26, 2009, 2:45 AM