开发者

MS Access UPDATE QUERY Problem

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.Parameter开发者_JAVA百科Name = "@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?


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.

https://web.archive.org/web/20210927192856/http://www.4guysfromrolla.com/webtech/092601-1.2.shtml

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜