You declare an OdbcConnection variable (
Baglanti
), but you don't create an instance of the class:
public static OleDbConnection Baglanti;
The only other reference to
Baglanti
in your code is when you use it in
btnGiris_Click
You need to assign an instance to the variable, probably at the top of the method:
protected void btnGiris_Click(object sender, EventArgs e)
{
string kullaniciTipi;
Baglanti = new OleDbConnection(baglantistringi);
...
if (Baglanti.State == ConnectionState.Open)
{
Baglanti.Close();
Baglanti = null;
...
}