SQL Serverデータベースからパスワードと電子メールを取得するログインページを作成しようとしています。私はパスワードと電子メールを比較したいと思います。テキストボックスからデータベースのデータにデータを比較しようとすると、エラーメッセージが表示される
System.Data.SqlClient.SqlException:
private void buttoninloggen_Click(object sender, EventArgs e) { using (SqlConnection connection = new SqlConnection(connectionstring)) { connection.Open(); string emailinlog = textBoxEmailLogin.Text; string passwordinlog = textBoxPasswordLogin.Text; string vergelijken = "select * from Account where Email = @email and Password = @password"; SqlDataAdapter adapter = new SqlDataAdapter(vergelijken, connection); MessageBox.Show("tot hier is t goed"); using (SqlCommand ophalen = new SqlCommand(vergelijken, connection)) { ophalen.Parameters.AddWithValue("@email", emailinlog); ophalen.Parameters.AddWithValue("@password", passwordinlog); DataTable tafel = new DataTable(); adapter.Fill(tafel); if (tafel.Rows.Count > 0) { MessageBox.Show("ingelogd"); } } } }
は、私は、このエラーメッセージが表示されます 'スカラ変数 "@email" を宣言する必要があります。'
私は間違っていますか?
はまだ同じエラーを得た...私はそれが何か他のものだと思います.... – MFox