|
You can also copy / move them to the solution's folder and then click "Show All Files" and then select the root folders and "Include in Project". Voila
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|
|
Hi All,
I have a SQL Server at my office. I can VPN into the office from home in order to access the server. I have a program that makes a connection to this server when it loads up. I do this in a thread, but for the sake of this message I actually put this code in the _Load portion of my app (just to take the delegates, etc, out of the equation). I have a worker thread that checks the connection as well and updates a label to tell you if you are connected or not. If the worker thread detects it is not connected, it will try to re-connect. If I VPN into the office, and then run the app, it works fine. If I disconnect (after I've run the program and connected for the first time) the app does what it should and tells me that I'm disconnected. If I then VPN back in, after a few seconds the label is updated and it says the connection is restored.
The problem that I am facing is that if I am not VPN'd into my office (ie, it cannot see the server from the beginning) it will NEVER connect. It just keeps erroring out in the catch block and the message is that the connection could not be established. I have tried switching the Data Source over to an IP address just to be sure that it was not the DNS resolving that was messing up, and that does not work either. I have tried putting a Thread.Sleep(5000) in the Catch block upon failure just in case I was bombarding the server with too much, that does not work either. I cannot figure out what the problem is. I've done a bunch of different tries at it (ie, redo the connection string each try on the while loop and call Dispose()) ... nothing works. If anyone knows what my problem is I would appreciate a helping hand.
Here's what the code looks like in a nutshell.
while (!bConnectedToServer)
{
myConnectionString = "Initial Catalog=PROGARCHIVE;Data Source=192.1.1.20;User ID=test;Password=test;Connection Timeout=5;";
myConnection = new SqlConnection(myConnectionString);
try
{
myConnection.Open();
bConnectedToServer = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
myConnection.Dispose();
Thread.Sleep(5000); //I've tried it with various values and none at all
}
}
I have also tried something of the nature:
myConnectionString = "Initial Catalog=PROGARCHIVE;Data Source=192.1.1.20;User ID=test;Password=test;Connection Timeout=5;";
myConnection = new SqlConnection(myConnectionString);
while (!bConnectedToServer)
{
try
{
myConnection.Open();
bConnectedToServer = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
Thread.Sleep(5000); //I've tried it with various values and none at all
}
}
|
|
|
|
|
hi,
I also had a similar problem some days ago. I was not able to connect to my network database through Sqlclient. I just changed the SqlClient and put there Oledb. All is working fine now. If you can do it, just give it a try.
Hope it works in ur case also.
I think there is some problem in SqlClient, when it comes to access the database over a LAN. MS should look into it (my perception ofcourse !)
PS:
Caution !!!! You will have to change the SqlConnection, SqlCommand and all other object to OledbConnection and all ..... Also rebuild the connection string using the Oledb Provider.
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Anant Y. Kulkarni wrote: I think there is some problem in SqlClient, when it comes to access the database over a LAN. MS should look into it
Perhaps there was a problem with your network. I've never had a problem connecting over a LAN or through VPN connections.
|
|
|
|
|
Out of curiosity, what happens when you remove the Connection Timeout=5 from the connection string. The default, if not specified, is 15 second to allow the connection to be established, but you are telling it to give up after only 5.
|
|
|
|
|
I never even thought to play with that value at all...
Anyhow, I removed that line and it works now!
The only thing that I am curious about is that when this scenario happens (I am not VPN'd in, I run the program, it cannot connect right away and then I VPN in) ... It will take it about 60-120 seconds to finally make that connection. I put a MessageBox.Show() in the Catch block of the attempt to connect, and it will pop up 5 to 10 times saying "Could not connect...blah blah". But I've run it 30 or 40 times now and it always connects it just takes a lot of failures before it finally does.
Thanks a ton for the input!
|
|
|
|
|
Hi i have a custom control and everything is working fine, except in my test project when i compile it the settings of the control revert back to the default settings, why are my settings not persisting, and how do i go about fixing this problem?
Thank you,
|
|
|
|
|
Hello Tyrus,
Are you talking about property settings during design time?
If yes, it's possible if you are using the "DefaultValue" attribute at your custom properties.
Don't forget to init your class variables correct.
All the best,
Martin
|
|
|
|
|
well all my variables are initialized correctly to start with and then ill go in and change settings and stuff compile and then they dissapear and revert back to the original settings, and it doesn't happen every time i compile either it seems to be somewhat sporadic. i also am getting some wierd tasks telling me that there is object reference not set to an object or somehting like that.
|
|
|
|
|
It seems that you are using an object in your constructor, property or an eventhandler which is not "living" yet. So you get an null reference exception even at design time. Thats because the constructor of youre custom control is called when you compile your project.
If you whant you can mail me the controls code or post it.
All the best,
Martin
|
|
|
|
|
what's the different from Crystal Report and Reporting service?
anyone can help me ?
thinks.
I am a chinese I love my country.
|
|
|
|
|
HI,
I have windows servcie application developed with VS2005 and running on Windows server 2003. It runs in debug mode perfectly. But when I run it in release mode I get follwoing error:
"An unhandled exception ('System.IO.IOException') occurred in VentFSWatcher.exe [560]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on."
I am running this servcie under NTAuthority/Local Servcice account and this acount has been granted permission on al relevant folder. How to find what is the cause of the error. In debug mode I can attach this process and step through but in release mode I do not know how to find error. This windows servic e listens on a particulr path and when a file is dropped it picks up and moves to another folder. Files are dropped by ftp server. This works well in debug mode as mentioned.
Code looks like follow:
if(file.Exists)
{
lock(m_SynLock)
{
file.MoveTo(pathToMove);
}
}
You help is valuble.
Thank you for nay help.
Bharat Gadhia.
In life, failures teach you as much as — or perhaps more than — successes.
Thank you very much for the help.
|
|
|
|
|
Hi,
Try this ...
Goto Project Properties -> Compile -> Advance Compiler Setting and uncheck the Enable optimizations check box if it is checked !
I also was not able to attach to windows service in VS 2005 some days ago. I did the above told thing and it worked fine !
Hope it works in ur case !
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hi,
Thank you for the suggestion. I was able to solve the problme. It was related to File creation and File Move operations occuring at about the same time. By inserting Thread.Sleep() function I solved the problme. Also I inserted Try Catch block and writing to error log file I could see where and what type of error ocurred duiring execution.
Thank you.
Bharat Gadhia.
In life, failures teach you as much as — or perhaps more than — successes.
Thank you very much for the help.
|
|
|
|
|
1. Create a new project
2. Place a tablControl on the form
3. Place a listView on a tabPage of the tabControl, Dock it, set BorderStyle to None and set its backColor to Red.
4. Set Padding property of the tabPage the listView was placed on (tabPage not tabControl) to 0 (All).
5. Run the project and you'll see it's not filling the tabPage completely from the left (it's ok from the right side).
How can I fix that?
Your help is greatly appreciated.
|
|
|
|
|
Hello All,
I was wondering if anybody had any experience with PDF creation in c#. I am working on a project where we have had a request to add the ability to export the output of our project (basic 2d line plots, graphics, text) to a PDF. I have seen a number of 3rd party components that advertise being able to create PDF's, and I suppose Adobe has something as well. The general price range seems to be about $100, which I don't mind paying for something that works and is easy to use. I am not trying to convert anything into a PDF (some packages seem to be advertising this feature), but create the PDF directly, and populate it with some graphics.
Anything out there that exposes a Graphics object that represents a PDF page that I could just draw to with the code I already have in place for printing?
Any advice?
Thanks!
Aaron
|
|
|
|
|
Search in codeproject, there are lots of articles about PDF there.
For example : http://www.codeproject.com/cs/library/AnotherPDFLib.asp
|
|
|
|
|
Hello Aaron,
ComponentOne has a PDF component, PDF for .NET, that will allow you to create PDF documents. The object model is similar to the Microsoft Graphics Class, so it is easy to learn. For more information, please visit http://www.componentone.com/ProductMain.aspx?ItemType=1&PanelIndex=6[^].
Suelinda W
Customer Engagement, ComponentOne LLC
|
|
|
|
|
well this is my first post on codeproject, first of all thanks too all that have posted so many good articles in the past that has helped me out greatly. anyways down to the question.
i was to create an application that will recieved Cisco Netflow packets (http://www.cisco.com/en/US/tech/tk648/tk362/technologies_white_paper09186a00800a3db9.shtml) and then parse out the data. store the data and then use RRDTool to create pretty little graphs. I have never done socket programming before or really know where to start. If i can aquire the individual pieces of data in those fields then i can dump it to txt files or a database or w/e i please . i'm pretty sure that i don't want to use raw sockets, and that i want to impliment a socket in the tcp/ip stack itself. I'm relitivily sure i can get the raw data itself, but from there i don't know how to turn the string of jibberish i would get into english. does anyone have any ideas? i'm not asking for a free hand out of code, but just to be pointed in the right direction. thanks.
|
|
|
|
|
Well, I would suggest to play with socket programming first by simply writing little programs. You could start with examples here on CodeProject. And eventually you will find the right way
Vitaliy
|
|
|
|
|
If I want array with elements of different types - what must I use instead of an array? (Since the elements in an array must be of the same type)
Arbitrary example: If I want an array that shows colors and their corresponding integer value.
Do I use a struct ( I don't think so)? So what would I use?
|
|
|
|
|
|
You could have an array of objects, or some other base class. Of course you would need to be aware of the performance issues with boxing/unboxing.
only two letters away from being an asset
|
|
|
|
|
If you want to store two different types like that and they correspond on a one to one basis I would use a dictionary.
Dictionary<string,int> d = new Dictionary<string,int>();
d.Add("Blue", 0x0000FF);
d.Add("Red", 0xFF0000);
d.Add("Green", 0x00FF00);
Console.WriteLine( "Blue is " + d["Blue"]);
Console.WriteLine("\nRed is " + d["Red"]);
Console.WriteLine("\nGreen is " + d["Green"]);
If you are going to have many different and arbitrary classes you probably need to rethink your program before you start plugging them all into an ArrayList, yank em out, and hope you cast correctly.
-- modified at 15:36 Friday 18th August, 2006
|
|
|
|
|
Hi,
You Can Also use hashtable.
Hope This Works.
Nitin...
|
|
|
|