|
Hello,
I am trying to run this program in VS 2003. This runs fine but I can't see the results in Vs 2003. Infact I am not using any grid or any thing like that but using Console.WriteLine to print the results. I know that this program prints in the command prompt but I am trying to find an option so that I can see the results in VS 2003 (either command window or any other window). Is there any other line of code that I can use to print the results in VS 2003?
static void Main()
{
//Application.Run(new Form1());
// 1. Instantiate the connection
string Connection;
Connection = "Data Source='TestServer';Initial Catalog=Northwind;Trusted_Connection=sspi";
//Connection = "Data Source='TestServer';Initial Catalog=Northwind;User id=sa;Pwd=development";
SqlConnection conn = new SqlConnection(Connection);
SqlDataReader rdr = null;
try
{
// 2. Open the connection
conn.Open();
// 3. Pass the connection to a command object
SqlCommand cmd = new SqlCommand("select * from Customers", conn);
//
// 4. Use the connection
//
// get query results
rdr = cmd.ExecuteReader();
// print the CustomerID of each record
while (rdr.Read())
{
//Console.WriteLine(rdr[0]);
System.Console.WriteLine(rdr[0]);
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
// close the reader
if (rdr != null)
{
rdr.Close();
}
// 5. Close the connection
if (conn != null)
{
conn.Close();
}
}
}
|
|
|
|
|
Writeline the program endstherefore you can't see anything. If you put readline at the end i think you can hold the console window to see the result
|
|
|
|
|
Hi,
You can include
using System.Diagnostics;
and in debug mode you can write in Visual Studio output window by using
Debug.WriteLine(" xxxxxxxxxxxxxxx ");
I hope it will help
-Samir.
|
|
|
|
|
There is only one way to do this. Write the output into a text file and open that file in the VS 2003 at run time. I hope, you got answer for your question.
Sr. Software Engineer
Irevna, India
|
|
|
|
|
Hi guys,
In my myClassA:usercontrol I am drawing a rectangle but when i drag and drop this user control on a form I always have to set the width and height becuase somehow i can only see half the cricle. Is there a way when i put the control I get i can see its real state (whatever way I designed in the user control class).
Thanks
|
|
|
|
|
See if it works.
In the Load event of the control, try to set the width and height if the control.
Regards,
Arun Kumar.A
|
|
|
|
|
Hi,
Im trying to connect to a mysql server, the connection detials are below:
("Network Address=ip:3306"
+ "Initial Catalog='db1';"
+ "Persist Security Info=no;"
+ "User Name='login';"
+ "Password='pass'");
The problem is it complains that the first piece of the string isnt correcty formed. Any ideas?
Regards,
Gareth.
|
|
|
|
|
I don't use MySQL myself but just looking at your string there are three comments:
1) shouldn't "Network Address=ip:3306" be something like "Network Address=127.0.0.1:3306"
2) you use the ";" as a seperator but it's missing from the first aurument.
3) you've got quote marks "'" around most of the arguments except the first.
This would give the first line the following format:
("Network Address='127.0.0.1:3306';"
Just an idea..
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
I found this page which lists different connection strings dependant on the API (driver) you use:
http://www.connectionstrings.com/?carrier=mysql
I don't know if it helps?
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Hi Wayne,
Thanks for the website, looks very helpful.
Though, i have a new problem now.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Any ideas?
Regards,
Gareth.
|
|
|
|
|
Hi,
When i try to type in a textbox while running a project in VS 2005 i get the below error, any ideas what this means?, im guessing its a env setting in vs i need to change, but what?
LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Regards,
Gareth.
|
|
|
|
|
|
Cheers, that fixed it.
Regards,
Gareth.
|
|
|
|
|
I want to write a little program that would convert any specific string into a mysql hash password. I can do this thru mysql itself, however I want to implimenent with C#. it Mysql I would just do Password('string') and that would give me 5569C9CAE94A5E43CD192F9F6AD2A1C171D5465F, How can I do this with C#?
|
|
|
|
|
What hashing algorithm does the MySQL function use?
The System.Security.Cryptography namespace contains providers for calculating MD5, MD160, SHA1, SHA256, SHA384 and SHA512 hash codes.
---
single minded; short sighted; long gone;
|
|
|
|
|
I'm not sure how to use this md5 hash. Can you give me a sample code to hash a basic string "string"?
|
|
|
|
|
|
im working on a editor that uses RichTextBox, and as a added feature, im using a syntax highliter from here -> http://www.codeproject.com/cs/miscctrl/SyntaxHighlighting.asp?df=100&forumid=185470[^]
I downloaded the source and editted the form1.cs with like this:
shtb.FilterAutoComplete = true;
and i compiled the source and when i tested my App, the autocomplete feature isnt working...
I even tried to download his demo project and tried to use autocomplete and it didnt work. Where im i going wrong... can someone help me please ~
|
|
|
|
|
Use the forum at the bottom of the article to ask for help with article thingys
led mike
|
|
|
|
|
It's as if he given up support on the project, i went thuru all of the coments first, someone actually reported this problem and no one (including the author) replied, so i thought i'd ask at the main board where the smart people hang out >_>;
Anyone actually has a useful answer? this is one last feature i need implementing in my editor, any help would be much appreciated...![Frown | :(](https://www.codeproject.com/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
Check the function CompleteWord() in the file SyntaxHighlightingTextBox.cs - you need to press CTRL and SPACE whilst typing a word,
it works me - if does not work for you put a breakpoint on the WndProc(ref Message m) function
for the case Win32.WM_KEYDOWN: and see why it's not being shown
Note: I did convert this into a Visual Studio 2005 solution but I presume that this should still work in 2003?
Mark.
|
|
|
|
|
Beautiful stuff mate, i honestly didnt know abt Ctrl + Space to bring up the autocomplete box.
This works so well, im glad i posted this question here. Thanks allot again ^_^;
|
|
|
|
|
I am designing a Windows Application. In the Settings class of this Application the user has to set a Directory Path to a Software program. I created a browsing button With the "FolderBrowserDialog" and with "FolderBrowserDialog.SelectedPath" I show this selected path in a textbox.
Now this works, but the "FolderBrowserDialog.SelectedPath" is not remembered by the application when I restart it.
How can can I store this SelectedPath? ( I also need this path as a string variable in other Classes)
|
|
|
|
|
|
Sorry but your link gave me an internal blackout... I just started programming in Visual C# using the Visual Studio manual. Sofar everything was clear, but I got stucked in how to handle my application settings. In the manual I found in the ApplicationSettingsBase this example for saving settings:
<br />
private void Form1_FormClosing(object sender, FormClosingEventArgs e)<br />
{<br />
frmSettings1.FormText = this.Text + '.';<br />
frmSettings1.Save();<br />
so my questions are:
1. Are the ApplicationSettingsBase commands the way to store and reload application settings?
2. If yes: is this applicable to the problem/question in my first message?
3. where should i put this code?
|
|
|
|