hallo,
meine Reihenfolge ist:
1.sqlpos
2.vorname
3.nach
4.Firma
Nach dem Import von einer riesen Datenbank habe ich jetzt:
1.sqlpos
2.vorname
3.nach
4.plz
ok, meine Software liest die Spalten aus und trägt Sie nach der Reihenfolge ein.
Jetzt steht bei plz die Firma drin.
Wie kann ich die Reigenfolge ändern?
Die Problembeschreibung ist vage, sorry.
Es klingt nach:
- CREATE VIEW mein_wunsch_view AS SELECT …
und dann select from mein_wunsch_view.
Unterm Strich klingt das nach einer notwendigen genaueren Untersuchung. Wohin kann ich mein Angebot schicken?
thx,
ich habe das Problrm ganz anderst gelöst
stimmt, eine Erklärung bin ich schuldig, ich teile gerne mein Wissen.
Ich muss so oder so eine Tabelle füllen.
Textbox1 ist der Name
Textbox25 ist die PLZ
if (!(String.IsNullOrEmpty(textBox25.Text)) && (!(String.IsNullOrEmpty(textBox1.Text))))
{
//
// sql = "select * from kunden where nachname like '%Lux%' AND plz like '%70174%';";
sql = "select * from kunden where nachname like '%" + textBox1.Text + "%' AND plz like '%" + textBox25.Text + "%';";
nono = 1;
}
if (nono == 1)
{
try
{
string connstring = String.Format("Server={0};Port={1};User Id={2};Password={3};Database={4};",
Form1.tbHost, Form1.tbPort, Form1.tbUser, Form1.tbPass, Form1.tbDataBaseName);
NpgsqlConnection conn = new NpgsqlConnection(connstring);
conn.Open();
NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, conn);
// i always reset DataSet before i do something with it.... i don't know why :-)
ds.Reset();
// filling DataSet with result from NpgsqlDataAdapter
da.Fill(ds);
// since it C# DataSet can handle multiple tables, we will select first
dt = ds.Tables[0];
// connect grid to DataTable
dataGridView1.DataSource = dt;
// since we only showing the result we don't need connection anymore
conn.Close();
// dataGridView1.Columns.Remove("sqlpos");
}
catch (Exception msg)
{
// something went wrong, and you wanna know why
MessageBox.Show(msg.ToString());
throw;
}
}
Sobald ich in die Tabelle reinklick werden die Daten in weitere Textboxen gefüllt.
Point p = dataGridView1.PointToClient(Cursor.Position);
DataGridView.HitTestInfo hit = dataGridView1.HitTest(p.X, p.Y);
// MessageBox.Show(dataGridView1.Columns[3].HeaderText);
if (hit.RowIndex > -1)
{
for (int su = 0; 28 > su; su++)
{
if (dataGridView1.Columns[su].HeaderText == "anrede") //anrede
{
textBox2.Text = dataGridView1.Rows[hit.RowIndex].Cells[su].Value.ToString();
}
if (dataGridView1.Columns[su].HeaderText == "vorname") //vor
{
textBox3.Text = dataGridView1.Rows[hit.RowIndex].Cells[su].Value.ToString();
}
if (dataGridView1.Columns[su].HeaderText == "nachname") //nach
{
textBox4.Text = dataGridView1.Rows[hit.RowIndex].Cells[su].Value.ToString();
}
...................usw
Der Code darf weitergegeben werden lol
Gerne erkläre ich weitere Teile von dem Programm. Ohne dem Board wäre ich nie so weit gekommen.