Witajcie!
Mam problem z programem w którym po kliknięciu w przycisk ZALOGUJ SIĘ wyskakuje mi następujący błąd:
A tutaj wstawiam wam kod C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace REVITAL_Logic
{
public partial class Form1 : Form
{
OleDbConnection cn = new OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = F:\Rivista Logic\Baza danych\database.accdb; Persist Security Info=False;");
OleDbDataAdapter da;
DataTable dt = new DataTable();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
private void zaloguj_Click(object sender, EventArgs e)
{
da = new OleDbDataAdapter("select * from uzytkownicy where uzytkownik='" + login.Text + "' and haslo='" + password.Text + "'", cn);
da.Fill(dt);
if (dt.Rows.Count <= 0)
{
logowanie.Text = "Login bądź hasło jest nieprawidłowe";
}
else if (dt.Rows.Count > 0)
{
logowanie.Text = "Login Succsufully";
}
dt.Clear();
}
private void button6_Click(object sender, EventArgs e)
{
cn.Open();
checkConnection.Text = "Połączono z bazą danych";
cn.Close();
}
}
}
Możecie mi jakoś pomóc ? Walczę z tym już od 2 godzin aż wreszcie udałem się po pomoc do WAS :D
Z góry WSZYSTKIM dziękuję
// edit
Treść komunikatu:
Tytuł: Nieobsługiwany wyjątek
Treść: System.Data.OleDb.OleDbExpection: "Nie podano wartości dla jednego lub kilku wymaganych parametrów"
Błąd dotyczy: 36lini < da.Fill(dt); >