|
I'm attempting to connect to a MySQL database from my ASP.NET application (c#). Here's my code:
string connString = "Database=games;Data Source=http://[my server's IP]/mysql;User ID=group; Password=" + strSystemPasswords[3];
conn = new MySqlConnection(connString);
conn.Open();
The database is contained in the mysql directory under the web server's root. (I added a space between group; and Password to prevent a smiley.)
When I run the code, I get the following error for conn.Open():
"The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for "
I've researched the problem and have found the standard answer is that the address can't be resolved. However, I am assuming that this is not the problem in my case, as I can navigate to that exact address with my web browser. But I haven't found any alternate causes for this error.
Any suggestions?
Thanks for your help!
|
|
|
|
|
Your datasource is local to the server. ASP.NET is a server-side only technology that generates HTML for a client. Change your "Data Source" so your code is looking for it local to the server filesystem, not over an http connection.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, I'm trying to capture text from a texbox inside of another program. In other words, I have a window handle of an exterior program. This program contains a textbox. I would like to capture that text. Is there a set of API commands that would enable me to do this? I've been looking on MSDN for a while and haven't found anything. Any help would be greatly appreciated. Until then, the searhc continues...
|
|
|
|
|
Try : <a href="http://www.pinvoke.net" rel="nofollow">http://www.pinvoke.net</a>[<a target=_blank title='New Window' rel='nofollow' href="http://www.pinvoke.net">^</a>]
|
|
|
|
|
Use the win api SendMessage twice first with WM_GETTEXTLENGTH then again with WM_GETTEXT. GO ahead and try it yourself with the example at pinvoke.net. If you still can't get it to work just let me know.
/\ |_ E X E GG
|
|
|
|
|
Hello,
It's easy to get a pointer to the window of all running applications. But i need to find out the position and the size of the minimize button outgoing from the pointer to this application window.
Anybody know if this is possible or knows how to do this?
Thanks for help.
FreeClimber
|
|
|
|
|
I have a class "Person"
Person has 2 propertys:
Name
Adress
Person p = new Person();
p.Name = "Mike";
p.Adress = "Anywhere";
Now I have a problem with adding it to the Combobox.
In the Combobox list, I only see [namespace].Person all the time, not "Mike".
There are possibilities through indexes, Hastables ... and so on..., but are these the only possibilities ?
Is there a way to add the object to combobox directly ?
|
|
|
|
|
You could override the ToString() method of you Person class.
public override string ToString()
{
return this.Name;
}
/cadi
|
|
|
|
|
The problem is still the same. with ToString, I only put the string in the combobox, not the object itself.
So the object should be added into the combobox and the Combobox Item description shouldn't be the objects name.
|
|
|
|
|
No, you do not!
You add the object and the Combobox uses the to String method of the items to display a text.
Try this:
<code>
private void Form1_Load(object sender, System.EventArgs e)
{
this.comboBox1.Items.Add(new Person());
foreach(object o in this.comboBox1.Items)
MessageBox.Show(String.Format("Item is of type {0} and is the persons name is {1}",o.GetType().FullName, (o is Person) ? ((Person)o).Name : "not a person") );
}
it works fine in my test.
/cadi
24 hours is not enough
|
|
|
|
|
cadi said it right. ComboBox actually calls ToString() method of it's Items . For your class default ToString() returns string representation of type. When you override ToString() , combobox will display Person.Name field, but e.g combobox.SelectedItem can still be instance of Person .
David
|
|
|
|
|
Thx, this works.
I added .ToString directly before.
|
|
|
|
|
I have a problem with UnitofWork.I have many objects in my UnitofWork but the problem is I dont have an update order in my hand.in an article it said....."the key to the puzzle is table-level topological sort".
What does this mean? thanks
|
|
|
|
|
Hi
{
I have to Generate an XML file from an existing XML.
The existing File is on HDD and and the Elements of the file are shown in a Tree view.
Now when the tree node is selected the child nodes are displayed in the checked List Box.
}Done
Now the selected chiled nodes along with its coressponging Paret node in tree view will be writen to another XML file.
Does any one have SAMPAL code for this task or can any one giude me.
Thanks.
Best Regards.
|
|
|
|
|
Is it possible to write code for selecting a folder and a file together from OpenFileDialog? The default operation appears only selection of a file.
|
|
|
|
|
Is it possible to change the name of the "Open" button in the OpenFileDialog class instance in C# application?
|
|
|
|
|
no because it is declared 'sealed' so you cannot inherit from it or modify it.
in the msdn library you can see this:
public sealed class OpenFileDialog : FileDialog
|
|
|
|
|
I did it once,:->
But that was because i created my own open file and open forlder dialog from the scratch.
|
|
|
|
|
It is possible but you have to use P/Invoke to create this dialog from scratch using the GetOpenFileName() call and the OPENFILENAME structure from the Win32 platform SDK on MSDN. In the OPENFILENAME structure specify a hook procedure for the lpfnHookProc data item. In this hook procedure capture the WM_INITDIALOG message, get the handle to the OK button, and call SetWindowText to change the name from "Open" to something else.
I hope this helps.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Hi,
I want to update the value for a particular key in Hashtable.
How to update.
Usually in VB 6, i have used item property. But here i unable to use it
Thanks in Advance
Balamurugan
|
|
|
|
|
|
Hi,
I am a beginner level programmer and I would be happy
if somebody can clarify me this small doubt.
I want to know,if using 'this' to refer to the local variables inside a class is a good practice. using 'this' would be a bit costly or it would infact aid performance ?
Please clarify this , would be more thankful if you can give me some links for improving code performance.
Thanks a ton.
|
|
|
|
|
It doesn't make any difference. Whether you explicitly use "this" or not, the compiler generated code will have to use it to refer to member variables and methods.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
As far as I know, it doesn't hurt or boost the performance. It's rather a question of taste. Do you like the style of using 'this' for calling private variables ?
In my opinion it doesn't matter if you use 'this', but I prefer only using it when there's no other way. An example:
private int var;<br />
<br />
public SomeClass(int var) {<br />
this.var = var;<br />
}
WM.
What about weapons of mass-construction?
|
|
|
|
|
A local variable is one which is within the scope of the method or property, not the class. I think what you mean is member variable (aka field in .NET)
Using the this keyword is just making explicit what the compiler will do implicitly anyway. There is no perfomance advantage to using it or not as the resulting code will be compiled to be the same anyway.
The only time where it does make a difference is where you have a local variable and a member variable with the same name. You must use the this keyword to refer to the member variable in that instance otherwise the compiler will assume you are referring to the local variable.
Does this help?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|