|
Nope. It would appear that the database code is not the same as what you've tested in the non-service version.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Code is very much the same. I am executing that in a console application. While carrying out your previous instruction I was given the permission to execute services(Log on services). So I restarted the machine and then carried out your instruction. Now I have strong feeling that some permission has to be given to my USERID and PWD on the local machine. And the serive was installed using "LocalSystem" property.
More over I am logging to a domain. Keeping this in mind I asked you about those question. Let me know if you need more info from my side.
Srinath
|
|
|
|
|
Do i have to impersionate the user...while accessing the data base ?
Srinath
|
|
|
|
|
Could it be that (part of) your Oracle is installed "for this user only" instead of
"for all users" ?
As a test: use another user account on the same machine and try again.
Luc Pattyn
|
|
|
|
|
Your are right. If I log into machine as a local user i am not able to access the database. Another strange problem, I right click on my console application and then select "Run As" option. Here I am using loginID and PWD, which I have been using so far and working fine. But the application throws an error
OCI.DLL
The specified module could not be found.
Could not create an environment: OCIEnvCreate returned -1.
But the same application if double clicked returns the correct answere from the procedure.
Srinath
|
|
|
|
|
Googling oci.dll I found
http://www.dll-files.com/dllindex/dll-files.shtml?oci[^]
which seems to indicate the file somehow could have been installed on your machine
separate from the normal Oracle files, so all is not lost.
Search your PC for it, and move or copy it to a more appropriate location (where ever
that might be).
Luc Pattyn
|
|
|
|
|
Actually all those dlls are picked up from my env path variables.
So that seems to be ok.... But the acutal problem still exists.
Srinath
|
|
|
|
|
Just checking, is your env path the same for everyone ?
And is it set before the service gets started ?
-- modified at 18:04 Tuesday 9th January, 2007
Luc Pattyn
|
|
|
|
|
How can I code for controlling end of a database query and command? Assume I must run a messagebox when query finished certainly. How can I be sure query was finished (in code) ?
|
|
|
|
|
Do u mean to say you need to collect the time stamp ? before and after query execution ?
|
|
|
|
|
I have a class inhertied from PrintDocument in that I am trying to write in a file while am in printpage event handler. The problem is that the file gets created but there is not text/data. Is it even possible to do.
protected void ThePrintDoc_PrintPage (object sender,PrintPageEventArgs ev)
{
StreamWriter sw =new StreamWriter(new FileStream("path.txt", FileMode.Create, FileAccess.Write));
sw.Write("hello");
sw.Close();
}
|
|
|
|
|
Could be because the file doesn't get closed properly. Does the data appear after the application exits?
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|
|
no. if i apply the same codes in a non inherited PrintDocument then i can see the file with data but if i wrote same in PrintDocument class means
(public class TextPrintDocument : PrintDocument) then i don't see
Thanks
|
|
|
|
|
Did you do the following inside your class??
public class TextDocument: PrintDocument {
public TextDocument()
:base()
{
PrintPage += new PrintPageEventHandler(ThePrintDoc_PrintPage);
}
protected void ThePrintDoc_PrintPage (object sender,PrintPageEventArgs ev)
{
StreamWriter sw =new StreamWriter(new FileStream("path.txt", FileMode.Create, FileAccess.Write));
sw.Write("hello");
sw.Close();
}
}
It could be that your method wasn't hooked up to the printpage event of the PrintDocument class, which you inherit from.
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|
|
Try calling your StreamWriter's Flush() method before you try and read the file:
protected void ThePrintDoc_PrintPage (object sender,PrintPageEventArgs ev)
{
StreamWriter sw =new StreamWriter(new FileStream("path.txt", FileMode.Create, FileAccess.Write));
sw.Write("hello");
sw.Flush();
sw.Close();
}
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
your 3 lines of StreamWriter code work fine inside one of my PrintPage methods.
some possibilities:
- your file already exists and is read-only or locked by another process
- you ar looking at the wrong file (using a relative path, and current directory maybe changed)
- you are getting an exception but missed it somehow
Luc Pattyn
|
|
|
|
|
Thank you all, It was putting in a wrong folder. so i just have the absolute path now.
This leads to my next question which is if i try to write in a file then there is no data in a file but if comment the loop then there is something.
I want to write in a file until i<5. is there something i am not doing right.
for(int i=0;i<5;i++)
{
sw = new StreamWriter(@"C:\myfolder\path.txt");
sw.writeLine(i.ToString());
sw.flush();
}
sw.close;
Thanks
|
|
|
|
|
Hello,
I'm not sure if it's usefull to create a new instance of StreamWriter (in youre case 5) inside the for loop.
If yes, you would have to call the close method also in the loop, otherwise only the last StreamWriter instance would be closed (disposed).
If not, you should do this:
sw = new StreamWriter(@"C:\myfolder\path.txt");
for(int i=0;i<5;i++)
{
sw.WriteLine(i.ToString());
sw.Flush();
}
sw.Close();
All the best
Martin
|
|
|
|
|
Yes, you should create only one streamwriter, then have the loop, or whatever makes
up the file's content, then sw.Close().
And sw.Flush() is not doing anything useful here.
It is useful only when the content generation takes a long time, so you
want to force the sw to already send to file what it currently contains; it is
impled by a sw.Close(): when closing the sw, everything it still holds is flushed,
i.e. sent to the file.
If you are used to C (or some similar language), you can compare the StreamWriter you
are using to a regular file with functions fopen, fwrite, fclose (and optionally fflush).
Luc Pattyn
|
|
|
|
|
What is the correct value for SW_SHOWNOACTIVATE in ShowWindow function? Is it 0x0700 or 12? Do I have to give in hexadecimal or decimal?
Can anyone please help me find this?
Muthu.
|
|
|
|
|
File C:\...\VC98\Include\WINUSER.H Line 257: #define SW_SHOWNOACTIVATE 4
Luc Pattyn
|
|
|
|
|
I am sorry. I am using C#, Framework 1.1
Thanks.
Muthu.
|
|
|
|
|
The symbol SW_SHOWNOACTIVATE does not look at all like a C# name, it really is part
of the good old Win32 API specifications.
Whatever you do at a high level, in whatever language, in the end the UI stuff gets
handled deep down in Windows so when you do some magic that is supposed to understand
SW_SHOWNOACTIVATE, just pass it the value of 4.
Luc Pattyn
|
|
|
|
|
I believe that it is actually 4, and it doesn't matter whether or not it is hex.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
Can anyone please help me to write code (language: any .Net platform) to append text to a WAV file?
I know the basic file I/O all I need is to know how to write proper header information in the WAV file along with proper byte count which includes the actual WAV file and newly appended text at the end.
Found this link: http://www.codeproject.com/useritems/Concatenation_Wave_Files.asp
But in this example the program amalgamates 2 WAV files as in my case its 1 WAV file + 1 text file = 1 WAV file with all information in it.
Thank you in anticipation.
Regards,
Amit
-- modified at 9:17 Monday 15th January, 2007
|
|
|
|