ArticWolf
Hectopat
- Katılım
- 9 Aralık 2020
- Mesajlar
- 742
- Çözümler
- 5
C# da Access ile veri çekmeye çalışınca sütun veya satır da bilgi yok diyor. Oysaki girili
Not:
studentno
'yu çektiğimde alıyor ama böyle çekince boş hatası veriyor.Not:
studentno
integer türünde bir değişken.
C#:
OleDbConnection con = new OleDbConnection();
con.ConnectionString = @"Provider = Microsoft.ACE.OLEDB.12.0;" + @"Data Source = " + Application.StartupPath + "\\databases\\students.accdb;";
con.Open();
string sql = "SELECT * FROM Student Where StudentNo = @no";
OleDbCommand cmd;
cmd = new OleDbCommand(sql, con);
cmd.Parameters.AddWithValue("@no", no.SelectedText);
OleDbDataReader rdr = cmd.ExecuteReader();
stuname.Text += (string)rdr["StudentName"];