Note that there are some explanatory texts on larger screens.

plurals
  1. POcopy blob data from one table to another in c#
    text
    copied!<p>basically i have a service which looks at two tables - one resides on a remote server, the other locally. I am trying to write a program which will select any required files from the remote server and copy them locally. i can get this working for standard records but how do i handle the blob in c# - i am just starting out with the language so be gentle</p> <p>a snippet of what i have is below</p> <pre><code>public static void BroadcastCheck(String ip_addr) { OdbcConnection local = new OdbcConnection("DSN=local"); OdbcConnection cloud = new OdbcConnection("DSN=cloud"); local.Open(); cloud.Open(); OdbcCommand update1 = new OdbcCommand("UPDATE exchange set status = '1' where `status`='0' and inp_date=chg_date and LEFT(filename,12)='" + ip_addr + "' and type='UPDATE'", cloud); update1.ExecuteNonQuery(); OdbcCommand broadcastSelect = new OdbcCommand("select * from exchange where inp_date=chg_date and LEFT(filename,12)='" + ip_addr + "' and status='1' and type='UPDATE'", cloud); OdbcDataReader DbReader = broadcastSelect.ExecuteReader(); int fCount = DbReader.FieldCount; byte[] outByte = new byte[500]; while (DbReader.Read()) { String type = DbReader.GetString(0); String filename = DbReader.GetString(1); String data = DbReader.GetBytes(1); OdbcCommand broadcastCopy = new OdbcCommand("INSERT INTO exchange(type,filename) VALUES('"+type+"','"+filename+"'"+data+")", local); broadcastCopy.ExecuteNonQuery(); } itouchcloud.Close(); itouchlocal.Close(); Console.Write("Broadcast Check Completed \n"); } </code></pre> <p>Basically the cloud db is queried and may return multiple results, i want to process each record returned and copy it to the local DB. i have looked around and cant seem to really get a decent solution, i can do this simply in Visual FoxPro 9 so im guessing there is a similar solution.</p> <p>any help appreciated :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload