Click here to Skip to main content
15,893,622 members
Home / Discussions / C#
   

C#

 
QuestionWindows Forms Applications Pin
Zeyad Jalil19-Mar-12 22:25
professionalZeyad Jalil19-Mar-12 22:25 
AnswerRe: Windows Forms Applications Pin
Abhinav S19-Mar-12 23:11
Abhinav S19-Mar-12 23:11 
GeneralRe: Windows Forms Applications Pin
Zeyad Jalil19-Mar-12 23:22
professionalZeyad Jalil19-Mar-12 23:22 
AnswerRe: Windows Forms Applications Pin
JF201519-Mar-12 23:31
JF201519-Mar-12 23:31 
AnswerRe: Windows Forms Applications Pin
Pete O'Hanlon20-Mar-12 0:09
mvePete O'Hanlon20-Mar-12 0:09 
GeneralRe: Windows Forms Applications Pin
Zeyad Jalil20-Mar-12 0:26
professionalZeyad Jalil20-Mar-12 0:26 
AnswerRe: Windows Forms Applications Pin
Comfizzy20-Mar-12 4:38
Comfizzy20-Mar-12 4:38 
Questionhow to retrieve data from mysql database and display it into textbox in c# Pin
Xonel19-Mar-12 21:24
Xonel19-Mar-12 21:24 
Hi,

I have this code below that is not working like i want it to and has no errors when i debug. I want it to display a member values in respective textboxes that are in a table called 'addpeople' by a click of a button AFTER i key in the member ID of a member.
Text boxes are like;
Title
member ID
First name
Last Name
Address 1
Address 2
....
...
...
Email..

Here is the code:

C#
private void btnView_Click(object sender, EventArgs e)
       {


               string input = cmbMemberId.Text;
               string conn = "server=localhost;user=root;password='';database=m_chama;";

               MySqlConnection myconn = new MySqlConnection(conn);

               string sql = "SELECT * FROM addmember WHERE Member_ID = '" + input + "';";


               MySqlDataAdapter da = new MySqlDataAdapter(sql, myconn);
               DataTable dt = new DataTable();
               da.Fill(dt);

               if (dt.Rows.Count == 0)
               {

                   MessageBox.Show("No data found.", "Not Exists");

               }
               else
               {
                   foreach (DataRow dr in dt.Rows)
               {
                   if (dr[0] + "" == input)
                   {
                       txtFirstName.Text = dr[0] + "";
                       break;
                   }
               }

              }

           }

AnswerRe: how to retrieve data from mysql database and display it into textbox in c# Pin
Abhinav S19-Mar-12 22:13
Abhinav S19-Mar-12 22:13 
AnswerRe: how to retrieve data from mysql database and display it into textbox in c# Pin
OriginalGriff19-Mar-12 22:40
mveOriginalGriff19-Mar-12 22:40 
GeneralRe: how to retrieve data from mysql database and display it into textbox in c# Pin
Xonel20-Mar-12 0:53
Xonel20-Mar-12 0:53 
GeneralRe: how to retrieve data from mysql database and display it into textbox in c# Pin
OriginalGriff20-Mar-12 1:14
mveOriginalGriff20-Mar-12 1:14 
AnswerRe: how to retrieve data from mysql database and display it into textbox in c# Pin
PIEBALDconsult20-Mar-12 3:42
mvePIEBALDconsult20-Mar-12 3:42 
QuestionHymns Pin
Bollyjames19-Mar-12 19:03
Bollyjames19-Mar-12 19:03 
AnswerRe: Hymns Pin
Mycroft Holmes19-Mar-12 20:52
professionalMycroft Holmes19-Mar-12 20:52 
AnswerRe: Hymns Pin
Abhinav S19-Mar-12 22:22
Abhinav S19-Mar-12 22:22 
AnswerRe: Hymns Pin
DaveyM6920-Mar-12 1:08
professionalDaveyM6920-Mar-12 1:08 
QuestionCAD system design Pin
Bollyjames19-Mar-12 18:58
Bollyjames19-Mar-12 18:58 
AnswerRe: CAD system design Pin
Alan Balkany21-Mar-12 4:54
Alan Balkany21-Mar-12 4:54 
Questioni have a global mouse hook working but.. Pin
gmes2919-Mar-12 14:07
gmes2919-Mar-12 14:07 
AnswerRe: i have a global mouse hook working but.. Pin
Dave Kreskowiak19-Mar-12 16:08
mveDave Kreskowiak19-Mar-12 16:08 
GeneralRe: i have a global mouse hook working but.. Pin
gmes2920-Mar-12 0:59
gmes2920-Mar-12 0:59 
Questionsame enumeration, different results? Pin
CCodeNewbie19-Mar-12 12:15
CCodeNewbie19-Mar-12 12:15 
AnswerRe: same enumeration, different results? Pin
PIEBALDconsult19-Mar-12 12:31
mvePIEBALDconsult19-Mar-12 12:31 
GeneralRe: same enumeration, different results? Pin
CCodeNewbie19-Mar-12 12:39
CCodeNewbie19-Mar-12 12:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.