Solved

Updating a Table on a remote server using a Dataset, cant get it working

Posted on 2006-07-19
1
169 Views
Last Modified: 2010-04-24
This is the code iam trying to get to copy all data from one table and insert it in a remote server.

The data is filled into the dData dataSet just fine.. and the MessageBox pops up to .. however no data is written..

                SqlConnection sCnxn = new SqlConnection("server=195.69.130.88\\SQLEXPRESS,1434;database=tasklist;uid=sa;pwd=x7xvlwv1;");
                sCnxn.Open();
                DataSet dData = new DataSet();
                SqlCeDataAdapter aDBs=new SqlCeDataAdapter("Select * from phoneLog", cnxn);
                aDBs.Fill(dData);
                SqlDataAdapter bDBs = new SqlDataAdapter("select * from phoneLog",sCnxn);
                bDBs.Update(dData);
                MessageBox.Show("Sync completed");

Can someone tell me what iam doing wrong ?
0
Comment
Question by:mSchmidt
1 Comment
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 500 total points
ID: 17140776
1. I don't see you creating 'cnxn' object.
2. Write the UpdateCommands and then call update as shown in the link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconupdatingdatabasewithdataadapterdataset.asp

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
destructor called after for each 7 36
template declaration 35 142
SSIS Script Task pick up the latest CSV file 4 134
SHA256 Code Signing 4 164
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question