|
I receive a NullReference Exception on the entry of this [WebMethod]:
//In constructor:
FileStream fs=new FileStream(@"c:\BHQGUI\temp\Idea.mod",FileMode.Create, FileAccess.Write, FileShare.None);
//
[WebMethod]
public void scrivi(Byte[] byteArray)
{
fs.Write(byteArray,0,256);
}
called by this:
private void ArchiviaServer(object sender, EventArgs arg)
{
FileInfo fileInfo = new FileInfo("c:\\BHQGUI\\temp\\myidea.mod");
FileStream fileReadStream = fileInfo.OpenRead();
Byte[] b = new byte[256];
localhost.db myDb=new localhost.db();
while (fileReadStream.Read(b,0,b.Length) > 0)
{
myDb.scrivi(b);
}
myDb.chiudi();
myDb=null;
}
Anyone could help me? Is Byte[] a wrong type for WebService??
Please help me thanx in advance
Marco
|
|
|
|
|
Uploader wrote:
I receive a NullReference Exception on the entry of this [WebMethod]:
Thats because the filestream is null, not the byte[]. Try making the filestream static to make sure that is the problem, then figure out how you would prefer to handle it.
Hope this helps
PS: Remember a webservice is only a website with methods.
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
thanx I made an error, because I declared the filestream as a property of the class, but in the constructor I haven't notice that I'm overwriting it.
myclass{
private Filestream fs;
myclass(){
Filestream fs=........;
}
}
BUT
using WebService my method scrivi(byte[]) doesn't work, instead it works using remote object.
Marco
|
|
|
|
|
Hello all gurus,
I just discovered that one of my tables in my MS Access DB happened to name "Module". Any simple SELECT statement to this table would crash with "E_FAIL: Unspecified Error 80004005" when I do:
...
OleDbReader rd = myOleDbCommand.ExecuteReader(...);
Currently I use:
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;" + "data source = " + frmModularDocsSystem.sDBFullPathName;
QUESTION:
Can I use a newer or older version of Microsoft.JET.OLEDB engine? or RDO? or Something else? to get around this weird problem. So, I don't have to rename my "Module" table. Because Changing its name will break an un-measured amount of codes in my existing applications, if that's the last solution.
Thanks a billion $ to you all
Khang Nguyen
PS: or may you have other tricks?
|
|
|
|
|
Can you but [] around the table name like you can in sql server? Try that
Select * from [Module] might work I don't have access on this machine to try it.
|
|
|
|
|
WOW! You're great! It works like a miracle. You saved me. Thanks so much.
Khang Nguyen
|
|
|
|
|
Hi,
I've started writing a program using version 1.0 of the framework, but now I would like to install version 1.1 and start using that. Do I need to do anything special with my application in order to get it to use version 1.1 of the framework instead of version 1.0 ?
Thanks
- monrobot13
|
|
|
|
|
Nope. MS Have done a good job of getting the new version to play nicely with the first. You will need a copy of the latest version of VS though, but you can upgrade for $30.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
How do you access the volume control in c#? Is there a way to do it w/o using direct x? Any help would be appreciated.
|
|
|
|
|
I'm trying to read a password from the Console and I need it to hide what is being typed. I'm using System.ReadLine() but I can't figure out how to hide what is being typed. There must be simple solution but I can't find it. Any ideas?
|
|
|
|
|
You will have to look at the Win32 Console API, specifically turning on/off echoing, and will you are there colors are a breeze too
<a TITLE="See my user info" href=http:
|
|
|
|
|
may be using Win32 Old API
it can be possible !!
|
|
|
|
|
I have an old Win32 legacy app. I’m able to start the process and send key presses to it (via sendmessage) from another app. What I would like to do is remove this program from the taskbar. An ideas?
setting CreateNoWindow=true; does not work
I start the process with this:
mp = new Process();
mp.StartInfo.FileName = AppPath+"\\Win32App.exe";
mp.StartInfo.WindowStyle= ProcessWindowStyle.Minimized;
mp.StartInfo.CreateNoWindow=true;
mp.Start();
|
|
|
|
|
Can anyone explain me what this mean? Is it related to Dispose()?
Make the component implement both deterministic and non-deterministic finalization
"...if you don't want to hear things that piss you off don't piss off other people. SIMPLE." - Steven Hicks This signature was created by "Code Project Quoter".
|
|
|
|
|
Take a look at the MSDN article "Gozer the Destructor"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/deepc10192000.asp
|
|
|
|
|
|
Kant wrote:
deterministic
aka Dispose() done by user
Kant wrote:
non-deterministic
aka ~Class or Finalize() done by GC
<a TITLE="See my user info" href=http:
|
|
|
|
|
leppie wrote:
aka ~Class or Finalize() done by GC
So I have to implement the ~Class for my component or just override the Finalize()?
Make the component implement both deterministic and non-deterministic finalization
"...if you don't want to hear things that piss you off don't piss off other people. SIMPLE." - Steven Hicks This signature was created by "Code Project Quoter".
|
|
|
|
|
A component derived class should already implement IDispose, override Dispose() (if and only if you have unmanaged resources that need to be freed)
<a TITLE="See my user info" href=http:
|
|
|
|
|
Here[^]) is an article that is newer than the other one, which has a nicer design pattern for handling disposing and finalizing.
|
|
|
|
|
Arun,
Thanks for pointing that article out. It is much better. (If fact one example in the older article will not compile w/ .NET 2003).
Thanks again.
|
|
|
|
|
Hello,
I'm looking for a way to get the memory adress of a C# object.
Any idea is welcome .
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
This is specifically hidden to the user as object address change continuously due to the GC. If you debug a program with CorDbg, these addresses will be shown, but like said, unlike C/C++ they are likely to move during each garbage collection.
Cheers
<a TITLE="See my user info" href=http:
|
|
|
|
|
Hi Leppie,
I was expecting something like that. It makes totally sense. I'm now sure.
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
You wont believe it, but I'm stuck with this issue as well (building a VM emulating the CLR VM on top of .NET). If you are intereseted look at the ld.XXXa IL instructions. There seems to be no highlevel functions for this. Maybe something like this would work (no it wont dammit). Maybe...
load an address on stack and then return that as IntPtr, but you have to carefull...
As you can see I'm bit lost too! What I do know (think rather) is that be default GetHashCode() returns the signed addr of a non Value /String object.
I could be wrong.
<a TITLE="See my user info" href=http:
|
|
|
|