sadhana belge

sadhana belge

  • NA
  • 34
  • 10.4k

single web application uploading data

Jul 26 2013 7:38 AM
Hello ,


 i have web application. i want to transfer data with tables from one database to other database in the diiferent server offline.
how to do plz tell me.

i did the some code:
 source = ConfigurationManager.AppSettings["ServerName"].ToString();
            database = ConfigurationManager.AppSettings["DatabaseName"].ToString();
            userid = ConfigurationManager.AppSettings["UserId"].ToString();
            pwd = ConfigurationManager.AppSettings["Password"].ToString();

            string DestinationServer = ConfigurationManager.AppSettings["DestinationServer"].ToString();
            string Duserid = ConfigurationManager.AppSettings["Userid"].ToString();
            string Dpass = ConfigurationManager.AppSettings["password"].ToString();

            SqlConnection dbcon1 = new System.Data.SqlClient.SqlConnection(source);
            dbcon1.Open();

            SqlConnection dbcon2 = new System.Data.SqlClient.SqlConnection(DestinationServer);
            dbcon2.Open();


            SqlDataReader dr;
            SqlCommand cmd = new SqlCommand("select * from tblClientInfo",dbcon1);

                dr = cmd.ExecuteReader();

                   

                while (dr.Read())
                {
                  string Sql = "insert into tblClientInfo(ClientId,Name) values(" + dr.GetInt32(0).ToString() + "," + dr.GetString(1) + ")"; 

                SqlCommand cmd1 = new SqlCommand (Sql,dbcon2);

Answers (3)