Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

anthasaurus

@anthasaurus
About
Posts
5
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Set value of Excel cell to the result of a query [modified]
    A anthasaurus

    Hi all, I am looking at ways to automate the process of getting data from SQL Server 2008 into an Excel (2007) spreadsheet. I would like to set the value of a cell in the spreadsheet to the result of a SELECT COUNT query. Is this possible? Regards, Anthony

    modified on Thursday, August 26, 2010 5:21 AM

    Database database sql-server sysadmin question

  • Save DataGridView changes to database through multiple layers
    A anthasaurus

    Ah so it did, as I've corrected it. Thanks for pointing that out.

    C# database tutorial question sql-server com

  • Save DataGridView changes to database through multiple layers
    A anthasaurus

    Hi, I have worked through the MSDN example of Creating an N-Tier Data Application. However, I'm struggling to get started with my 'save changes' functionality for a DataGridView. Can anyone offer any advice? My solution consists of SQL Server 2008 (I'm using the NorthWind sample database to go along with the walkthrough linked above), a Data Access Tier, Data Entity Tier, DataService and Presentation Layer and currently my app displays the DataSet in two DataGridViews. I understand the order of method invocations that is required to achieve what I want, but I'm struggling to get started with the coding of it. I.e capturing the changes made in the DataGridView, saving them to the DataSet and then committing the DataSet to the database via the DataService and Data Access Tier. Apologies for the long post and if I have missed out any info that would help you answer my question. Anthony

    C# database tutorial question sql-server com

  • FTP transfer corrupts .PNG files
    A anthasaurus

    Thanks for your response Nagy. I have modified my code to use BinaryReader. I'm still able to transfer the files, but they end up being ~60% the size of the originals. I'm still unable to view the files due to corruption. Please can you advise whether my code is trying to do the right thing or not (see below)?

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftpuser...etc");
            request.UsePassive = true;
            request.UseBinary = true;
            request.Method = WebRequestMethods.Ftp.UploadFile;
            request.Credentials = new NetworkCredential("username", "password");
    
            BinaryReader br = new BinaryReader(File.Open(fileLocalDir, FileMode.Open));
            
            FileInfo info = new FileInfo(fileLocalDir);
            byte\[\] testArray = new byte\[info.Length\];
    
            int i;
            for (i = 0; i < info.Length; i++)
            {
                testArray\[i\] = br.ReadByte();
            }
    
            request.ContentLength = i;
            
            try
            {
                Stream requestStream = request.GetRequestStream();
                requestStream.Write(testArray, 0, i);
                requestStream.Close();
    
                FtpWebResponse response = (FtpWebResponse)request.GetResponse();
                response.Close();
            }
    

    Regards, Anthony

    C# sysadmin help

  • FTP transfer corrupts .PNG files
    A anthasaurus

    Hi, After transferring PNG images to an FTP server, I am unable to open them as they are being corrupted. My code is as below:

                FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://... etc.");
                request.UsePassive = true;
                request.Method = WebRequestMethods.Ftp.UploadFile;
                request.Credentials = new NetworkCredential("username", "password");
    
                StreamReader sourceStream = new StreamReader(fileLocalDir);
                byte\[\] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
                sourceStream.Close();
                request.ContentLength = fileContents.Length;
    
                Stream requestStream = request.GetRequestStream();
                requestStream.Write(fileContents, 0, fileContents.Length);
                requestStream.Close();
    
                FtpWebResponse response = (FtpWebResponse)request.GetResponse();
                response.Close();
    

    Another thing to add - when I download the file from the FTP server and open in IrfanView, the error below is displayed: "C:\Folder\file.png: Can't read file header! Unknown file format or file not found! (For unicode file names, please activate the Unicode PlugIn in 'Properties -> Languages')" Thanks for any assistance, Anthony.

    C# sysadmin help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups