EINFÜGEN von Daten aus Textbox zu Postgres SQL

Ich nur noch lernen, wie die Verbindung von C# - und PostgreSQL.
Ich möchte zum EINFÜGEN von Daten aus tb1(Textbox) und tb2-Datenbank. Aber ich weiß nicht, wie man code
Meinen bisherigen code WÄHLEN Sie aus der Datenbank.
das ist mein code

private void button1_Click(object sender, EventArgs e)
    {
        bool blnfound = false;
        NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=postgres;Password=admin123;Database=Login");
        conn.Open();
        NpgsqlCommand cmd = new NpgsqlCommand("SELECT * FROM login WHERE name='" + tb1.Text + "' and password = '" + tb2.Text + "'",conn);
        NpgsqlDataReader dr = cmd.ExecuteReader();

        if (dr.Read())
        {
            blnfound = true;
            Form2 f5 = new Form2();
            f5.Show();
            this.Hide();
        }

        if (blnfound == false)
        {
            MessageBox.Show("Name or password is incorrect", "Message Box", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            dr.Close();
            conn.Close();
        }
    }

Also bitte helfen Sie mir den code.

InformationsquelleAutor user1479013 | 2012-06-28

Schreibe einen Kommentar