Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate filename on FTP same as local name
    primarykey
    data
    text
    <p>i have this code, where i generate xml file from sql database:</p> <pre><code> int counter; int counter2; private void GenerovaniVse() { SqlConnection con = new SqlConnection("Data Source=****"); string strSQL = "select w.KOD_...."; SqlDataAdapter dt = new SqlDataAdapter(strSQL, con); DataSet ds = new DataSet("ITEMS"); dt.Fill(ds, "ITEM"); FileStream strFileName = File.Create(@"C:\\Users\\L\\Desktop\\" + (counter++) + ".xml"); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.Unicode; using (XmlWriter xmlWriter = XmlWriter.Create(strFileName, settings)) { ds.WriteXml(xmlWriter); xmlWriter.Close(); } } </code></pre> <p>And This code from upload this file to ftp:</p> <pre><code>private void Upload() { FileInfo f = new FileInfo("C:\\Users\\L\\Desktop\\" + (counter2) + ".xml"); long original_vel = f.Length; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(*****); request.Method = WebRequestMethods.Ftp.GetFileSize; request.Method = WebRequestMethods.Ftp.UploadFile; request.Credentials = new NetworkCredential("***", "***"); StreamReader sourceStream = new StreamReader(??????); byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd()); sourceStream.Close(); request.ContentLength = fileContents.Length; long ftp_vel = request.ContentLength; //velikost souboru na ftp Stream requestStream = request.GetRequestStream(); requestStream.Write(fileContents, 0, fileContents.Length); requestStream.Close(); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); counter2++; response.Close(); } </code></pre> <p>Problem was in: strmfile.Close(); But now when i copy the xml to ftp, the file on ftp has smaller then original xml...and on original xml i have Unicode and in ftp file doesnt have any code... </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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