16,017,857 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Tunacha (Top 13 by date)
Tunacha
29-Oct-10 13:33pm
View
do u think it could possibly be the name variable?
Tunacha
29-Oct-10 13:17pm
View
i have tried that way aswell and it doesnt seem to pull anything but when i put an actual name in the query it works fine
Tunacha
29-Oct-10 3:17am
View
umm that i=did it work, did i maybe not define the name variable correctly?
Tunacha
27-Oct-10 2:25am
View
Okay well this is what i have tried so far
<pre> private void cbxnames_SelectedIndexChanged(object sender, EventArgs e)
{
string id;
id = cbxnames.ValueMember;
myConnection.GetConnection();
MySqlCommand txtfill = new MySqlCommand("SELECT * FROM users WHERE ID = '"+id+"'", myConnection.GetConnection());
txtfill.ExecuteNonQuery();
MySqlDataReader myReader = txtfill.ExecuteReader();
while (myReader.Read() != false)
{
string name = myReader.GetString("name").ToString();
uname.Text = name;
}
</pre>
But im having no luck with this, could anyone help
Tunacha
21-Oct-10 12:10pm
View
i keep getting No rows at point 0 on
this.Usernametxtbox.Text = DS.Tables[0].Rows[0]["name"].ToString();
and i dont know why
Tunacha
20-Oct-10 11:06am
View
Well this is what i have so far
<pre lang="cs">
DataSet sds = new DataSet();
MySqlCommand sql = new MySqlCommand("SELECT * FROM users", myConnection.GetConnection());
MySqlDataAdapter mydap = new MySqlDataAdapter(sql);
mydap.Fill(sds, "users");
this.UserList.DataSource = sds.Tables["users"];
this.UserList.DisplayMember = "name";
this.UserList.ValueMember = "id";
}
private void UserList_SelectedIndexChanged(object sender, EventArgs e)
{
myConnection.GetConnection();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM users WHERE name = '"+this.UserList.SelectedValue+"'");
MySqlDataReader reader = cmd.ExecuteReader();
Usernametxtbox.Text = reader.GetString("name");
ranktxtbox.Text = reader.GetString("groups");
}
<pre>
But i still cant figure out what im doing wrong,
Tunacha
20-Oct-10 9:49am
View
So basicaly what your saying is i would have to make it query the Selected name then use the retrieved data to fill the text boxes?
Tunacha
19-Oct-10 10:49am
View
Well when i do this
this.UserList.ValueMember = "id";
and then
Usernametxtbox.Text = UserList.ValueMember;
it just sets the Tet to id
Tunacha
19-Oct-10 10:42am
View
im kind of a noob to c# how would i set the ValueMember
Tunacha
19-Oct-10 10:12am
View
ive tried searching google for about an hour and have no clue as to how to do this,
so i randomly tried
private void Form2_Load(object sender, EventArgs e)
{
myConnection.GetConnection();
DataSet sds = new DataSet();
MySqlCommand sql = new MySqlCommand("SELECT * FROM users", myConnection.GetConnection());
MySqlDataAdapter mydap = new MySqlDataAdapter(sql);
mydap.Fill(sds, "users");
this.UserList.DataSource = sds.Tables["users"];
this.UserList.DisplayMember = "name";
}
private void UserList_SelectedIndexChanged(object sender, EventArgs e)
{
Usernametxtbox.Text = UserList.DisplayMember = "name";
}
And that code fills the listbox and when i select any name in the listbox all i get is name
of course this was just a random shot in the dark try for me because i cant seem to find anything on google
Tunacha
19-Oct-10 8:42am
View
Now i just need to figure out how to use this with a Dataset YAY Thankyou for the help
Tunacha
19-Oct-10 8:19am
View
How would i add conection error catching to that code thats what im overall trying to do with the isConnected
Tunacha
19-Oct-10 7:43am
View
i dont know how this would work for me as i am trying to make it so the User can enter ther connection details themselves, and When i try to use that code with my custom Connection string it tells me
"An object refrence is required for the non-static field, method, or propertly textbox1.Text
Show More