Click here to Skip to main content
15,909,498 members
Home / Discussions / C#
   

C#

 
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 
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 
Thank you guyz,

You gave me ideas and it worked. Smile | :)
This is the code that worked...

C#
private void btnView_Click(object sender, EventArgs e)
       {
           string input = cmbMemberId.Text;
           string conn = "server=[servername];user=[username];password=[userpassword];database=[databasename];";

           MySqlConnection myconn = new MySqlConnection(conn);
           string sql = "SELECT Member_ID, First_Name, ...., ......, ....., ....., ...., EMAIL FROM addmember WHERE Member_ID = @ID;";

           MySqlDataAdapter da = new MySqlDataAdapter(sql, myconn);
           da.SelectCommand.Parameters.AddWithValue("@ID", input);
           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)
                       {
                           cmbMemberId.Text = dr[0] + "";
                           txtFirstName.Text = dr[1].ToString();
                               .....
               .....
               .....
               .....
               ....
               ....
                           txtEmail.Text = dr[8].ToString();

                           break;
                       }

                   }

               }
       }


Thank you soo much.
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 
GeneralRe: same enumeration, different results? Pin
PIEBALDconsult19-Mar-12 12:43
mvePIEBALDconsult19-Mar-12 12:43 
GeneralRe: same enumeration, different results? Pin
CCodeNewbie19-Mar-12 12:50
CCodeNewbie19-Mar-12 12:50 
GeneralRe: same enumeration, different results? Pin
PIEBALDconsult19-Mar-12 13:20
mvePIEBALDconsult19-Mar-12 13:20 

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.