Autor Beitrag
mo0n_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

Win7
C#
BeitragVerfasst: Di 24.01.12 16:25 
hallo liebe community,
folgendes Problem:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
                string suche = textBox1.Text;

                OleDbConnection myConnection = new OleDbConnection(Settings.Default.Datenbank1ConnectionString);
                myConnection.Open();

                string mycommand = "SELECT * FROM Kontakte WHERE Firma ='" + textBox1.Text + "'";
                

                OleDbCommand cmd = new OleDbCommand(mycommand, myConnection);
                OleDbDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    string row = "";
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        row += reader.GetValue(i).ToString() + ", ";
                        this.dataGridView1.Update();
                    }
                                     
                }
                reader.Close();

                myConnection.Close();


Mit Hilfe meiner Textbox habe ich es immerhin geschafft einen bestimmten Datensatz von einigen MessageBoxen ausgeben zu lassen.
Jetzt möchte ich, dass NUR der ausgewählte Datensatz in meinem DataGrin angezeigt wird.
Bitte um nen Beispielquelltext!
Vielen Dank im vorraus

Moderiert von user profile iconTh69: C#-Tags hinzugefügt