I have a method that creates this value:
It is stored in the DB as <Binary Data>.
I use Select value from table where id = 1234.
This is the code that writes creates the value:
public void SetSessionData(string token, object data)
DataService ds = null;
ds = new DataService();
using (MemoryStream stream = new MemoryStream())
DALArgs args = new DALArgs();
BinaryFormatter b = new BinaryFormatter();
stream.Position = 0;
byte buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
I'm trying to figure out how I can assign the results of the select statement to a variable and create this response:
In a C# 2008 application, the code listed below ends up in the catch exception block. The error message says the file can not be
located in the specified location: "C://temp//09-24-2012//companyname_company.xlsx".
The value for the String fileName in the createCust is obtained from the value passed
to this method. The file does exist on the specified location.
The code I am referring to is listed below:
privatestatic ILog log = LogManager.GetCurrentClassLogger();
public Customer createCust(String CustId, String fileName)
Customer cst = new Customer();
byte buffer = null;
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fileStream);
long totalBytes = new System.IO.FileInfo(fileName).Length;
buffer = binaryReader.ReadBytes((Int32)totalBytes);
DateTime attachmentId = DateTime.Now;
cst.Id = attachmentId.ToString();
cst.MimeType = getMimeType(fileName);
cst.Value = buffer;
catch (Exception e)
I do not have any idea of why the file can not be located. The file exists in the path
that is passed to the createCust method. The location of the file path is specified as,
Thus can you tell me what could be causing the file not to be located and how to fix the problem?
True for the Windows API but not for the .NET System.IO classes which will accept either flavour of path separator. The redundant 'escaping' in the forward slashed path string is also gracefully ignored.
I'm currently doing Automated Acceptance test driven development, and I'm wondering if I should use my real Data Access Layer in my tests, or if I should fake out the data instead and just verify that what is being passed to/from is correct.
One issue is that the DAL is being developed by another team, and i'm coding the front end/business logic. I could make it work so I could test the real thing, but i'm not sure.
Most decent mocking toolkits will allow you to simulate return values from code, so you could call your DAL code and set it up to ignore certain calls and then return you carefully crafted data to satisfy your test criteria.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
Please help me to do a program that can download a file from a ftpserver with a progress bar that computes the percentage of the downloaded data. But it is by using the asynchronous method that was written from the codefile.cs and that will be called on th form.cs.The progress bar is in the other form.t.y
that can download a file from a ftpserver with a progress bar that computes the percentage of the downloaded data. But it is by using the asynchronous method that was written from the codefile.cs and that will be called on th form.cs.The progress bar is in the other form
What do you need help with exactly? Finding the manual? Well, here[^] it is, and even contains samples. Anything else you need help with?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
On the windows form, we put listbox for the list of directories. A button to get the list of directories and display it on the listbox. Another button for downloading, and another button for uploading. We just need Asynchronous method when downloading or uploading a file or getting the list of directories.
I have a small project that would require me to convert a ASP Classic with 5000+ lines of code to ASP .NET C# is there such a tool that can do this for me? I've already research for the whole week but all the tools that I've tried didn't work. should I do a rewrite for the whole thing?
Thanks in advance.
Last Visit: 31-Dec-99 18:00 Last Update: 20-May-22 10:23