Aamir Khan

Aamir Khan

  • NA
  • 277
  • 440k

Update Records from windows Form to the database Server on cloud

Nov 12 2011 12:34 AM
Dear Friends,
I have a query in windows apps
i have a form for exporting the records of the tables from Sql server 2000 to the server on the cloud(sql server 2000). i am able to insert new records but unable to Update the new records on cloud database.
my code is like this


 private bool Export(string tblSource, string tblDestination, string FromDate, string ToDate, string Date)
        {

SqlConnection con = oDAL.cloudConnection();
                SqlConnection con1 = oDAL.OpenConnection();
                SqlDataAdapter dap = new SqlDataAdapter();
                DataSet ds = new DataSet();
                DataSet ds1 = new DataSet();
                SqlCommandBuilder Ole_Build;
                 dap = new SqlDataAdapter("select * from " + tblSource + " where " + Date + " between '" + Convert.ToDateTime(FromDate).ToString("yyyy/MM/dd") + "' and '" + Convert.ToDateTime(ToDate).ToString("yyyy/MM/dd") + "'", con1);
                 dap.Fill(ds, tblSource);
                 SqlDataAdapter dap1 = new SqlDataAdapter("select * from " + tblDestination + " ", con);
                 Ole_Build = new SqlCommandBuilder(dap1);
                 dap1.AcceptChangesDuringFill = true;
                 dap1.AcceptChangesDuringUpdate = true;
                 dap1.Fill(ds1, tblDestination);

                 DataSet dsnew = new DataSet();
                 dsnew = ds.Copy();
                 dap1.Update(ds1, tblDestination);

                 return true;

}




pls let me know where it should me rectified.



Thanks & regards,
aamir