|
I am using Client-server Architeture for my c#.net Window base Application.
For that I am using TCP Remoting.
How can I preserve Connection object?
means Only once Connection will establish while log in.and it will available
me through life time of application.
Hallo
|
|
|
|
|
Singleton Pattern?
Been a while since I learned about it, but as I remember, it does the trick
|
|
|
|
|
Hello,
May be you can try to store that object using binary serialization and use it any time you want.
This is just one idea I want to share with you.
nishu
|
|
|
|
|
It's dangerous to assume that the connection will always be there throughout the life of your application. What happens if the machine at the other end is restarted? Your connection is no longer valid, and operations on it will fail.
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.
|
|
|
|
|
Hi all
I am working in c#.net
in my project i need create report using dynamic sql (i.e. parameter is passed at run time )
e.g
select * from employee where m_month = "runtimepara1" and m_year= "runtimepara2"
can anyone help me
thanks for your time
|
|
|
|
|
Build your query like this:
string sql = "SELECT * FROM Employee WHERE m_month = @month AND m_year = @year";
SqlCommand cmd = new SqlCommand(sql, connection);
cmd.Parameters.Add("@month", theMonth);
cmd.Parameters.Add("@year", theYear);
Also, SELECT * is inefficient. You should specify the columns that you want to return.
|
|
|
|
|
But I think it's used in Crystal ReportGeneration
i USED Reportviewer control in C#.net(InBuild not Crystal report)
Is their are solution to pass parameter dynamically or same Solu is also used
plz reply me
Thank's
|
|
|
|
|
The example you were given, shows you how to pass parameters dynamically. Or, do you mean, pass which parameters to select, dynamically ? In that case, if you're building SQL, you just need to conditionally add the columns you want.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all!
I want to change the height of a combobox in flat style, but I can't, Visual Studio 2005 resets the value back on a value depending on the used font size.
On a TextBox I can change the height (when property Multiline is false)
Has anybody an idea how I can afford this problem easily?
Thanks a lot
Jörg
|
|
|
|
|
Why you want a higher combobox?
You can create a new custom control... You have to put inside a Panel (with black borders), and inside the panel a combobox(properly aligned), and set no borders in the combo... Obviously, the background color of the panel and the combo has to be same. If you don't wanna to write a lot of properties, directly put only one property of type combobox(the combo) to access it from the form.
|
|
|
|
|
I want to reduce the height of the combobox, so that they are in the same style as my other controls.
I solved it with a user control. I put a textbox with a button on the right side over a hidden combobox. When I click on the button, the item list of the combobox is shown and I can choos an Item. When the Item is selected, the value is written in the textbox and the itemlist is hidden.
But I was looking for a way to avoid a user control, and use the system controls.
|
|
|
|
|
Hy guys,
I am trying to develop a lighting control application. I know that there are a lot out there but I like programming and I like lighting equipment.
But I want to put my command controlling to my controller in a second app to get the load off my UI. Does anyone know how to do something like this. The command controller app needs to expose events and data.
I hope someone can give me a hint or something.
-- modified at 6:53 Tuesday 13th February, 2007
|
|
|
|
|
I'd use some preferences file or registry to store some arguments for another app.
Use first one to process.start(app2);
Or even create a service that will handle it, while managing preferences file/registry with gui app1.
|
|
|
|
|
How can you create a service and how does is work. Do you know a good article about it or something? Or example?
|
|
|
|
|
This is a nice msdn walkthrough of creating and running windows services:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vjsharp/html/vjwlkWalkthroughCreatingWindowsServiceApplicationInComponentDesignerWithVisualJ.asp
As for controling another process:
Process[] proc = Process.GetProcessesByName("explorer");
foreach (Process pr in proc)
{ pr.Kill();}
this code would stop all explorer instances... and so on
This one would start your app2:
Process.Start("C:\\Path_to_your_app2\\app2.exe");
and eventually kill it:
Process[] proc = Process.GetProcessesByName("app2");
foreach (Process pr in proc)
{ pr.Kill();}
good luck and have fun.
P.S. forgot to mention you nedd System.Diagnostics for this to work
|
|
|
|
|
Thanks for the input. I will look at it.
|
|
|
|
|
What you really want to do, is get a thread doing all your hardcore work, apart from your main thread, which will handle the UI
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You totaly get it. Like a working thread. But I thought it would be better to put it in a seperate app. Maybe I can just start a thread and invoke my events from that and do it that way.
The worker thread send tcp messages almost 20 times a second to the dmx controller. At least that is the rate the controller updates. I have to get his state back and I get his state by requesting it.
Maybe I have to do it a different way.
|
|
|
|
|
If you're worried about the load on your UI, you should really remove the actual implementation into a separate worker thread. In windows forms, it's best practice to use the UI for what it is, and have the actual event handlers validate the data before sending the actual processing to another thread.
Remoting would be a good way to move your load off to another application, but if you need "events", you're in for a seriously rough learning curve.
Kay Lee
-Just your average coder
|
|
|
|
|
Well lets say I am open to learn anything. If you have any information about it I realy would like to look at it.
|
|
|
|
|
hi
if we try to create a setup it will have three files .msi,.exe and .ini file
But i want only one Setup.exe.......... please help me
My small attempt...
|
|
|
|
|
We use Inno Setup in our company - it's excellent tool. You can start with ISTool which will guide you through setup script creation (wizard) and then you can advance to your own scripting.
Default output is a single .exe file.
|
|
|
|
|
There is a problem there - I have this (not)working code. Problem is that GetData().Select() doesn't retrieve data for me, while if I add something like messageBox.Show(rows[0][1].ToString()) it suddenly works!
So, does that mean, program isn't able to retrieve information from tableadapter in time?
I tried adding Thread.Pause(1000) - process stops, but still no data...
Enybody have some ideas?
Oh, and I'm running Vista x64, can that be a problem source?
private void textBox3_KeyUp(object sender, KeyEventArgs e)
{
if (textBox3.Text.Length == 11)
{
textBox3.Text = kod.DeSifruoti(textBox3.Text); // changes some parts of text string in textbox3
DataRow[] rows = darbuotojaiTableAdapter1.GetData().Select("ID LIKE '"+ ((textBox3.Text)).Substring(0,5) +"%'");
label18.Text = rows[0][1].ToString() + " " + rows[0][2].ToString();
}
}
|
|
|
|
|
turns out CTRL+V are two key up events
|
|
|
|
|
Hi,
Kindly let me know the method / syntax about how to set windows form as "Always on Top".
and please convert the following VB command into C#.
Sendkeys "%{TAB}" <<== This is vb command kindly convert it into C#
Thank you
|
|
|
|