views:

47

answers:

1

Hi,

I am trying update my table from c# ado.net with this function.I am using for update process stored prosedure in access db.Everything working fine in MS Access side.Giving parameters to access and its update well.But when i tried this in c# ado.net side not giving any error but its not updating.I have got so many working stored procedure, like this.

Here my ado.net side codes;

 public void TakipsizlikGuncelleYeni(int kararNo, int kararYil, int yeniSorNo, int yeniSorYil,int durum)
  {
      con.Open();
      cmd = new OleDbCommand("sp_NewUpdate", con);
      cmd.CommandType = CommandType.StoredProcedure;
      OleDbParameter prmDurum = new OleDbParameter();
      prmDurum.ParameterName = "@durum";
      prmDurum.OleDbType = OleDbType.Integer;
      prmDurum.Value = durum;
      OleDbParameter prmTakipsizlikNo = new OleDbParameter();
      prmTakipsizlikNo.ParameterName = "@takipsizlikno";
      prmTakipsizlikNo.OleDbType = OleDbType.Integer;
      prmTakipsizlikNo.Value = kararNo;
      OleDbParameter prmTakipsizlikYil = new OleDbParameter();
      prmTakipsizlikYil.ParameterName = "@takipsizlikyil";
      prmTakipsizlikYil.OleDbType = OleDbType.Integer;
      prmTakipsizlikYil.Value = kararYil;
      OleDbParameter prmYeniSorYil = new OleDbParameter();
      prmYeniSorYil.ParameterName = "@yenisoryil";
      prmYeniSorYil.OleDbType = OleDbType.Integer;
      prmYeniSorYil.Value = yeniSorYil;
      OleDbParameter prmYeniSorNo = new OleDbParameter();
      prmYeniSorNo.ParameterName = "@yenisorno";
      prmYeniSorNo.OleDbType = OleDbType.Integer;
      prmYeniSorNo.Value = yeniSorNo;
      cmd.Parameters.Add(prmDurum);
      cmd.Parameters.Add(prmTakipsizlikNo);
      cmd.Parameters.Add(prmTakipsizlikYil);
      cmd.Parameters.Add(prmYeniSorNo);
      cmd.Parameters.Add(prmYeniSorYil);



      int sonuc = cmd.ExecuteNonQuery();
      if (sonuc > 0)
          MessageBox.Show("İşlem Tamamlandı", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Information);
      con.Close();
  }

and my Access Side stored prosedure ;

UPDATE Takipsizlik SET Durum = [@durum], YeniSorusturmaNo = [@yenisorno], YeniSorYil = [@yenisoryil]
WHERE (((TakipsizlikNo)=[@takipsizlikno]) AND ((TakipsizlikYil)=[@takipsizlikyil]));

i could not see any error ? Why this codes not update my table?

+1  A: 

Access receives parameters as "?" - they are not named - just use "Question mark" placeholder.

They must be passed in exact order they appear in the query.

This is a limitation of OLEDB.

http://www.4guysfromrolla.com/webtech/092601-1.2.shtml

Leon
thanx man :) problem's solve is "They must be passed in exact order they appear in the query." y r cool.
Ibrahim AKGUN