hallo liebe community,
folgendes Problem:
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
Th69: C#-Tags hinzugefügt