|
Hi all,
I have question about distributed application. I bought a book from Wrox, Professional C#.
And now, I am trying to work on one of the samples in chapter Distributed Application.
However, I got this error when I execute my client application:
"Trying to create a proxy to an unbound type."
Main purpose of the program is to create 2 small applications which execute a remote object
called Hello. It's using TCP as the channel. In both applications, I already put a reference to
remote object's namespace (DistributedApp1CL).
Server application has no problem at all, but client does. The error comes in this line:
Hello obj = (Hello)Activator.GetObject(typeof(Hello), "tcp://localhost:8086/Hi");
Does anyone know what this error means?
|
|
|
|
|
maybe because "tcp://localhost:8086/Hi" is a reference to a folder, and not the file that it is supposed to create something with?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
That is how remoting is done; the server binds to an IP:port and a name
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I added this to a form:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
}
On purpose i did not put base.OnPaint(e); in the method.
But the form gets painted and works as usual. Why?
|
|
|
|
|
Just a guess, but since you aparently did not put any other code in there could the compiler be optomising it out and never even including it the exe?
|
|
|
|
|
|
Hi Nish,
Perhaps, I’m making an incorrect assumption. Will overriding the OnPaint method prevent the controls placed on the form from appearing if I don’t call base.OnPaint ?
|
|
|
|
|
albean wrote:
Perhaps, I’m making an incorrect assumption. Will overriding the OnPaint method prevent the controls placed on the form from appearing if I don’t call base.OnPaint ?
This might seem strange to you, but even if you don't call the base class OnPaint, the form will draw itself neat and proper. Calling the base class only ensures that all the other delegates attached to this event are called.
Overriding OnPaint is not at all the same as handling CWnd::OnPaint in MFC or WM_PAINT in pure win32. If you really want to do all the painting on your own, override WndProc and handle WM_PAINT messages.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
albean wrote:
But the form gets painted and works as usual. Why?
The OnPaint handler is used to paint the surface of the form after Windows has done its painting but before controls have done theirs.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Hi,
I'm using SQL Server Desktop Engine. I need to add a new record, which has an autonumber field, and get that value. Any way to do it in one step??
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
In 1 Step? I can only do it in 2 steps:
I'm guessing that you are using an identity column.
If this is true then @@IDENTITY will give you the last identity inserted.
(Well, it gets some what complicated if there are triggers that are inserting rows into other tables that have identity columns so you need to watch out for that.)
I don't know much about the DataAdapter but you might want to run it and see what SQL it generates. I think it creates some stored procs that will return newly inserted records.
|
|
|
|
|
albean wrote:
I'm guessing that you are using an identity column.
Yes, that's how SQL converts Access's autonumber fields.
albean wrote:
If this is true then @@IDENTITY will give you the last identity inserted.
How do I use that?? I just barely know how to SELECT, INSERT, DELETE and UPDATE.
Thanks,
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
SELECT @@IDENTITY
If you created a stored procedure you could do this all in one fell swoop, however I would wait until you get more knowledge about SELECT, INSERT, UPDATE, and DELETE before looking into those.
If you have the budget I would highly recommend Wrox's SQL Server 2000 Programming for learning the in's and out's of, well, SQL Server 2000 programming [MSDE is SQL Server 2000 minus the GUI tools and some server optimizations]
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
|
I do what I can
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I'll try that as soon as I have time.
James T. Johnson wrote:
I would highly recommend Wrox's SQL Server 2000 Programming
I will look into it, I'll order it through Amazon.
Thanks,
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
James T. Johnson wrote:
SELECT @@IDENTITY
How do I call it?? My table name is "Customers" and column name "ID_customer".
Looking at the docs in VS.NET I found it should be called like:
"SELECT @@IDENTITY AS 'Identity';"
But I just can't make it work. Do I use a OleDbDataReader and use Identity as column name?? or use ID_customer as column name?
Thanks in advance,
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
On the OleDbCommand object, use the ExecuteScalar method; it will return the first column of the first row, in this case it will return the value of @@IDENTITY which is the first (and only) column of the first (and only) row.
OleDbCommand cmd = new OleDbCommand("SELECT @@IDENTITY", myConnection);
conn.Open();
int identity = (int) cmd.ExecuteScalar();
conn.Close();
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I called ExecuteScalar exactly like that and I get an "invalid cast" exception.
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
Here is an interesting question:
I have a form with a tab control with two tabs. If I create the dialog and add the tabs before displaying the form, everything comes ok. But sometimes, depending on the situation, only tab 1 is added before displaying the form.
The problem is when, because of a user action in tab 1, tab 2 must be shown also. Since there is no visible property or something like that for a tab, I create both tabs before showing the form, but only add tab 1. I pass a reference to both the tabs collection and tab 2 to tab 1 where they are stored as members. When such action is performed, I simply add tab 2 to the collection. Everything works as expected, except that all the controls in tab 2 appear very close to each other, using about half the available space.
Just in case it matters, I set the AutoScaleBaseSize property in the constructor of the form.
Any ideas?
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
Luis,
Que te paso?
If you send me your code I can maybe review it and help you out, I am not exactly sure what your problem is in your description.
Saludo,
Antonio
Soliant | email
"The whole of science is nothing more than a refinement of everyday thinking." -Albert E.
|
|
|
|
|
Hi Antonio,
The problem is basically that if I add the page before displaying the form, it shows correctly, with the controls perfectly arranged. If I add the page after the form is displayed, it comes up messed up (just that page, the other one (added before showing the form) is ok).
I can post some code tomorrow, I'm going to sleep now! (it's 2:27 am here)
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
|
Whoa! Thanks man. That's really cool.
David Stone
It seemed similar to someone saying, "Would you like to meet my knife collection?"
Ryan Johnston on Elaine's sig
|
|
|
|
|