|
When creating (if you do) the connection string in VS there's a button somewhere which says "Test Connection"
Although it probably does what you were thinking of doing anyway
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Ed, I have to test the connection programatically... I know that there is a button Test connection when you create a connection from VS... Let me explain: I have a form with the following textboxes: server name, username, password, database. When the user enters that data, I have to check that connection - that it really exists... My question is this: is there some other way (some built-in mechanism or something) of doing that than just creating a conenction string, creating a connection object, and waiting to see whether the open() method will throw an exception...
|
|
|
|
|
I think the only way is to trap any exceptions thrown by the Open method, I don't know and cannot see of any other way.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|
|
The only other way I can think of is open a connection the server and query the system tables for the database in question. This is of course not a very good option as it requires a higher level of credentials and the storage of two connection strings.
only two letters away from being an asset
|
|
|
|
|
Well, I'll try something Thanks for the reply
|
|
|
|
|
I have created a C# windows forms app.
On a certain click event I perform a console.writeline("Message Text").
The program buils fine, and runs without an error, but I don't get to see any output in a console window.
What must I do to see the output?
|
|
|
|
|
Do you use Visual Studio as your IDE ?
When you create a new Console Application, then you will get an empty Main method.
Just type : Console.WriteLine("Message Text");
It will show "Message Text" in ConsoleApplication.
|
|
|
|
|
there is an output window (in the menu -> view -> Output).
It should come in there somewhere. (note that other stuff comes in there is well.)
you could do this to filter a bit:
<br />
console.writeline("");<br />
console.writeline("Message Text");<br />
console.writeline("");<br /> which will write an empty line before and after your text.
Good luck.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
|
You can change the executable to compile as a Console App, nothing stops you from displaying Windows Forms. The only difference is, is that a Console is displayed if not run from a console. If this is only temporary for debugging purposes then you can change it back to a "Windows Forms" project when building for release.
You can also run it from the command-line without having to compile it as a Console Application and that will display the information (basically the Output window mentioned above does exactly this).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
I have a stored procedure that returns XML using FOR XML AUTO ELEMENTS, but there is no root element in the returned value.
I feel this may be the source of some errors im getting when trying to load the returned value into an XMLDataDocument.
Whats the best way to get a "root" element to ecapsulate the data?
Is there a way to make it return the results with a root? or a simeple way to add one to the datadocument in preperation before placing the returned value into it?
Thanks.
|
|
|
|
|
You might be able to create a XmlDocument with a base root and then set the roots innerXml to your xmldata.
Something like:
<br />
XmlDocument xmlDoc = new XmlDocument();<br />
<br />
xmlDoc.LoadXml("<root></root>");<br />
<br />
XmlNode root = xmlDoc.DocumentElement;<br />
<br />
root.InnerXml = your_xml_data;<br />
Not sure if this will work on first try. Havent got a compiler here but I've
set node.InnerXml successfully before.
Hope it works for you.
-Larantz-
For those about to code, we salute you.
|
|
|
|
|
Python has library 'difflib' which can be used to find coincidence percent between two sequences (strings). I am looking for the way to do the same (compare 2 strings) within .net platform.
So what is the name for an algorithm I am looking for? And where to look for it?
|
|
|
|
|
How can I print to the printer some text and increment any time I print
more text.
my code:
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
ePrint.Graphics.PageUnit = System.Drawing.GraphicsUnit.Millimeter;
// this go to metoda and return an object PrintPageEventArgs e
MiddleTable mTable = new MiddleTable(e);
mTable.PrintMiddleTable();
TopTable tTable = new TopTable(e)
tTable.PrintMiddleTable();
}
/////////////////
This is the code that will be printing in any page
I want to put him (e) in an obj - because it will be not change.
but when I print I whant to take this obj and add to him another text
I want that the code will not repeat on top will not repeat.
|
|
|
|
|
Hello everyone,
My problem is that I want to -simply- write selected images to CD/DVD in my app.. I searched for the xp burn area but found nothing (you know, you can say "burn this" to any folder and XP copy this file/folder to a burn area)..
Also the nero sdk may be too complicated..
What can I do to accomplish this task
Best regards..
.:: Something is Wrong ::.
|
|
|
|
|
Would someone please help me with this problem:
I have an expando on my MainForm that takes care of my menu, and I also have a MenuBar on the same form that also provides shortcuts to the items in the expando. After using the expando for a while, I then use the MenuBar and then suddenly my system crashes and an error: "Handle is not initialized " appears. (The expando and MenuBar sometimes call DataSets)
Mvelo Walaza
Visual C# Programmer
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
+27 729264095
|
|
|
|
|
What do your try catch blocks have to say about the whole thing?
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
What is the code to find out the number of pixels contained in an image and what is the code needed to draw a histogram.
tony-yeyo
|
|
|
|
|
diddy34 wrote: What is the code to find out the number of pixels contained in an image
width * height
diddy34 wrote: and what is the code needed to draw a histogram
Loop through the pixels, calculate the value that you want the histogram for (for an example intensity), and count how many there are of each value. Draw a diagram from the count.
---
b { font-weight: normal; }
|
|
|
|
|
Simple counts don't graph nicely :p
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi All,
I am having MFC ActiveX control which gives the graphical environment
I want to build the same control in C# ActiveX control.
I can use class library with user control to implement this but the problem is that the existing control is using many supporting libraries and included some .h files.
I can rewrite the basic code written in control but what should i do about the supporting libs and .h files.
OR
Is there any way u can suggest me to convert the existing control to the user control in C# and i can use the existing .h files as it is.
Gajesh
Pune(India)
|
|
|
|
|
Hi I faced a problem when converting for VS2002 to VS2005.
'Cannot declare variable of static type 'System.IO.File', because i declare an instance variable of this Type in my Old Code.
When i look in detail, the defination of System.IO.File has been changed
Previous Defination : public sealed class File : System.Object Member of System.IO
New Defination : public static class File : System.Object Member of System.IO
Does any body have solution, i cannot change my code,because its lot of code.
I wonder Why Microsoft Did this.
Regards
|
|
|
|
|
Microsoft provides two versions of the class now. File exposes its methods entirely static and FileInfo exposes instance methods. Both provide the same functionality, just in different ways.
In any case, you'll have to modify your code. You simply don't have a choice here, since you can't create an instance of a static class.
You'll have to do a Find/Replace and change your instances of File to FileInfo.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Generally true, but both classes existed already in 1.1. The reason that MS didn't make File static in 1.1 is simply that the operator didn't exist in that version.
|
|
|
|
|
I think he's a bit confused. He says he's using VS 2002, which is .NET 1.0... He could have used 1.1 with it, but I doubt it he's got it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|