|
How to store files(.doc files,.zip files) in a database and how to retrieve them
|
|
|
|
|
Are you using Oracle or SQLServer database? The concepts are the same for both, but the terminology is a little different.
If you are talking about Microsoft SQL Server then you will be looking at storing and retrieving a BLOB (Binary Large Objects). If you look up Microsoft SQL Server and BLOB you should be able to find all the resources you need to get started.
Try this to start with:
http://support.microsoft.com/kb/309158[^]
Hope this helps
Aaron
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
very thanks for reply me
|
|
|
|
|
IO.Directory.GetFiles("C:\\Windows"); will get me all the files in the windows directory, but is there a way to get all the absolute path names to these files that IO.Directory.GetFiles(path) finds??
|
|
|
|
|
Have a look at the Path Class[^] It has several functions which can help you.
|
|
|
|
|
hi friends.
I have converted a doc or image file to byte code by this code.
-------------------
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
int length = (int)fs.Length;
byte[] content = new byte[length];
fs.Read(content, 0, length);
--------------------
Now i want to convert this "content" i.e array of byte to actual file.
at the time of conversion in which object should i store the output (because i don't know the type of file i had converted to byte code).
How to do this.
(basically i m sending a file(image,doc,txt etc) from one machine to another remotely).
Hope you understand what i want to do here.
Thanks lot.
|
|
|
|
|
Just use Write method instead of Read and pass the byte array you have to it.
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Write);
int length = content.Length;;
fs.Write(content, 0, length);
|
|
|
|
|
and how to convert it back into a file??
|
|
|
|
|
It will be a file. Just don't forget to close the stream when you've done writing to it. Also, you might want to create the file first if it doesn't exists
|
|
|
|
|
I think your question related to knowing what type of file to save the byte stream as on your target machine? mr. Dalakishvili has told you how to save ti to your target path, all you need do is keep the same extension and it should work fine.
|
|
|
|
|
-------------------
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
int length = (int)fs.Length;
byte[] content = new byte[length];
fs.Read(content, 0, length);
--------------------
ah, a long way to convert a file into byte[],
try
byte[] mybytes = File.ReadAllBytes(filePath);
to write byte(back to file)
File.WriteAllBytes(filePath, mybytes);
hope this will help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi
Can someone please help me... It's seem like there is not a single way to get the column size from a dataset, table, datarow from SQL/Oracle in .Net using C# or VB
Thanks in advance
|
|
|
|
|
|
how to create folder in run time.
hai when i register my details create a folder in my name using .net with c#.if u know the code replay me.
modified on Wednesday, February 27, 2008 6:17 AM
|
|
|
|
|
|
thank u for your replay.
but i need .net with c# coding.
|
|
|
|
|
sugunavathysubramanian wrote: thank u for your replay.
but i need .net with c# coding.
And he gave you a link to the information that will aid you in writing the code. Part of being a developer is being able to research topics, understand it, then use what you learned to write the code you require. People here don't do your work, they help with specific problems. Tty to write the code yourself, and if you have a specific question, reply on THIS THREAD.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
|
Hi All,
I am handling keypress event for a RichTextBix control on my windows form. But, when i press a key on it, why its entering two times into keypress event code instead of once.??
I have added event handler only once on my form.
could anyone please suggest me how can I overcome this problem?
Thanks,
Durga.
Strength is life, Weakness is death.
--- Swami vivekananda
|
|
|
|
|
The delegate that handles the event raised has the invocation list of the methods to be called. It could be a reason that the code where the event is registered is called twice in the code execution, so check that out; the statement '+=' should be called only once when the form is loaded and the controls are created and added to it.
Muhammad Talha
|
|
|
|
|
Hi,
thanks for the reply. I'm sorry that it was my problem i added the event handler twice inadvertently.
Strength is life, Weakness is death.
--- Swami vivekananda
|
|
|
|
|
I am doing some asynchronous operation(Webclient.DownloadFileAsync() ) which is working on a separate thread. This will raise some events when the download process finished. Is it possible to stop the current thread until these events are fired ? Inside the event handler, I need to resume the thread. Any idea's ?
|
|
|
|
|
Hello,
If you mean Stop and Start the MainThread and you have the instance of the main Window for example.
You could call something like this from your working thread.
private void StopThread()
{
if(InvokeRequired)
{
Invoke.....
return;
}
Thread actThread = Thread.CurrentThread;
actThread.Suspend();
}
All the best,
Martin
|
|
|
|
|
Hi,
I am doing unit test with NUnit. The application which I am testing is a downloader which downloads files from remote server. So once the downloading finishes, I need to assert the file size. But since the download process is happening in the other thread, NUnit GUI is not waiting until download completes. Hence I was not able to test the events. I managed it by running the download class in another thread, just below to that I used Thread.Sleep() to make NUnit GUI wait for some time. By this time, the thread which I created will finish the download work and calls all events. So I can test the events too.
Anyway thanks for your suggestion.
|
|
|
|
|
i'd catch the donwloadcomplete event in unit-test and setting a flag (complete=true).
you can start the test then as follows:
<br />
[Test]<br />
public void TestDownload()<br />
{<br />
Downloader.DownloadReady += ...
Downloader.StartDownload(path)<br />
<br />
while (!complete)<br />
Application.DoEvents();<br />
}<br />
|
|
|
|