|
If the name consists of digits, the SQL query that you create would look like this: "SELECT 1 FROM [Test$] ". That would not get the data from the column "1", it would get the literal value 1.
Put brackets around the column name to specify that it's a name, not a value:
string sql = "SELECT [" + columnName + "] FROM [Test$]";
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yeappp, now its work. Thanks a lot...
|
|
|
|
|
Hi,
Iam using WMI and Win32_printjob to all the printer queue jobs...Iam using file watcher to run my service when a new file is copied from a specified location.
If I keep some thread.sleep then all the size and page no. iam to note them.
But without using thread.sleep Iam unable to read the file size and no. of page..but the file is copied from printer spooler to my specified location.
Now I want to my filewatcher service to invoke my service after a file is fully copied...How to accomplish this?
Kindly help me
|
|
|
|
|
Hi,
I developed a windows service which will copy some files in to the local system folder and then to another system. Right now my system and another system are connected in LAN and have shared along with Read/write access. It Is working for me.....
Requirement:-
but now I need to copy the files from one system to another system which are not connected in the LAN and not have shared permissions...
Assumption:-
On my search I came to know this can be done by FTP.
If I have to use FTP the what I have to do..?
1.Is that I need a FTP client application seperately?
2.Is that I need a FTP server application seperately?
3.Only one app can cater all these requirements?
All these I have to in the Windows service
Kindly help me
Thanks for all advise and help
|
|
|
|
|
If your application needs to send a file to another PC , that seems similar to a Client uploading to a FTP Server . So you need to make your application client and the need to have FTP Sever on the Other PC.
You can also create a WebServcie for the PC you need to put the file.
just pass the file in the service parameter.
Vikas Amin
UNITED STATES STEEL CORPORATION
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
hi vikas,
thanks for your help....
I have taken previously your help to solve my problem with printers and using WMI....
I need to guidence to do the FTP work
Iam very much thnakfull to you..
|
|
|
|
|
Hi guys, I want to write to a file but i am getting this weird error message. Only my application is using the path1. It Seems like file is being used by other process. I couldn't figure it out who is using which of my function is using the file.
using (StreamWriter sw = new StreamWriter(path1,false,Encoding.UTF8 ))
{
sw.WriteLine(""+doc.body.innerHTML+"");
sw.Flush();
sw.Close();
}
at System.IO._Error.WinIOError(Int32 errorCode,string maybeFullPath)
at System.IO.FileStream.Init(String path,FileMode mode,FileAccess access,Int32 rights,Boolean useRights,FileShare Share,Int32BufferSize,fileOptions options, SeCURITY_ATTRIBUTES secAttrs,String msgPath,Boolean bFromProxy)
|
|
|
|
|
netJP12L,
I don't think you need to call sw.Close() since it is in a using block. Though, i might be wrong!
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Are you allowed to write to the path? Do you have permissions, where are you trying to write to?
And, sw doesn't need to be closed, a using block will automatically call the Dipose method on an object that implements IDispose, StreamWriter does.
|
|
|
|
|
Yes, I do have permissions. I am creating folders, subfolders and file dynimacally and writing to the file. Even removing of sw.close or using statments doesn't help. Is there anyway i can find out which thread is using the file.
|
|
|
|
|
|
|
Thanks for answering guys, So far no lucky but what a funny thing i just noticed is that when i run the function to write to the file it throws exception related to file is being used by other process but when i run it again it actually writes ....what's going on I got no idea. Are my codes running faster than CPU ...;)
|
|
|
|
|
Hmm,
there may be several reasons.
Do you still have call to the Close-method in the end of using block. I suggest that you keep it.
Another thing. Check from your project properties / debug tab, is "Enable the Visual Studio hosting process" checked? If it is, what happens if you uncheck it and run the application again?
Mika
|
|
|
|
|
Exactly, you got the cure for my app problem.....before when i used to run my app in debug mode i was noticing this myapp.vshost.exe started...since i uncheck it works like charm.... Feel like i am on the safe planet....gonna giving u 5
|
|
|
|
|
You're welcome
Mika
|
|
|
|
|
I want to set the attrib of any file and folder using C#.NET button click event.
(As like in DOS: "attrib C:\test +S")
I want to run above DOS command with my C#.NET button click.
|
|
|
|
|
File.SetAttributes("textfile1.txt", FileAttributes.ReadOnly);
Just a suggestion for future!!! Try to Google the question you are posting. I believe, most of the times you will get get the answer there itself.
|
|
|
|
|
Thanks for your solution.
It works fine.
Can you please tell me about “attrib C:\test +s +h”. both attrib simultaneously.
|
|
|
|
|
|
Member 2837615 wrote: Can you please tell me about “attrib C:\test +s +h”. both attrib simultaneously.
You will need to write it in two statements; specifying the attributes you want.
|
|
|
|
|
Read up on how to use the SetAtributes method. A quick google search shows how to use a combination of attributes in one method call.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
The Class of Process is used to execute the command of DOS.
This class provide a Filed to set attrib.
|
|
|
|
|
Hi to all,
I need to read bitmap file which is basically scanned sheet like answers sheet.
So tell me if anyone knows.
Its urgent.
|
|
|
|
|
krinaljariwala wrote: I need to read bitmap file which is basically scanned sheet like answers sheet
Do you want to read it as image or extract the text from it?
If latter is the case, this should work:
FileStream fs = File.OpenRead("Holiday.bmp");
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
MemoryStream ms = new MemoryStream(data);
Bitmap bmp = new Bitmap(ms);
|
|
|
|