Hi,
I'm having CLI0100E Wrong number of parameters. SQLSTATE=07001 exception when I try to
private void PopulateTable()
{
bool IsConnecting = true;
while (IsConnecting)
{
try
{
cn = null;
cn = new OleDbConnection(strConn);
cn.Open();
sSqlCommand = "select a.sicil_no ,a.adi||\' \'||a.soyadi as isim,b.unvan_aciklama,a.ilkgir_tarihi,a.ayrilma_tarihi,a.sua,a.dogum_tarihi "
+ "from per015_ssk a,per003_ssk b";
da = new OleDbDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds, "Izin");
tb = ds.Tables[0];
cn.Close();
private void pbPost_Click(object sender, EventArgs e)
{
if (ds.GetChanges(DataRowState.Modified) != null)
{
DataSet dsChanges =ds.GetChanges(DataRowState.Modified);
try
{
BuildCommands();
// apply updates to the database
da.Update(dsChanges,"Izin");
ds.AcceptChanges();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message, "Error");
}
}
}
private void BuildCommands()
{
OleDbConnection cn =
(OleDbConnection)da.SelectCommand.Connection;
cn.Open();
// Declare update command with parameters
da.UpdateCommand = cn.CreateCommand();
da.UpdateCommand.CommandText = "update per010_ssk set "
+ " izin_tipi=?, "
+ " hareket_tipi=?, "
+ " izin_sure=? ,"
+ " kullanim_sure=?, "
+ " baslama_tarih=?, "
+ " bitis_tarih=?, "
+ " hakedis_tarih=?, "
+ " sua=? "
+ " where sicil_no=? and donem=? and hareket_tipi=? "
+ " and baslama_tarih=? and bitis_tarih=? ";
da.UpdateCommand.Parameters.Add("izin_tipi", OleDbType.Char, 0, "izin_tipi");
da.UpdateCommand.Parameters.Add("hareket_tipi", OleDbType.Char, 0, "hareket_tipi");
da.UpdateCommand.Parameters.Add("izin_sure", OleDbType.Integer, 0, "izin_sure");
da.UpdateCommand.Parameters.Add("kullanim_sure", OleDbType.Integer, 0, "kullanim_sure");
da.UpdateCommand.Parameters.Add("baslama_tarih", OleDbType.Date, 0, "baslama_tarih");
da.UpdateCommand.Parameters.Add("bitis_tarih", OleDbType.Date, 0, "bitis_tarih");
da.UpdateCommand.Parameters.Add("hakedis_tarih", OleDbType.Date, 0, "hakedis_tarih");
da.UpdateCommand.Parameters.Add("sua", OleDbType.Integer, 0, "sua");
da.UpdateCommand.Parameters.Add("donem", OleDbType.Char, 0, "donem");
da.UpdateCommand.Parameters.Add("sicil_no", OleDbType.Char, 0, "sicil_no");
} // *** BuildCommands ***
Basically
-I select and populate dataset with joint tables
-Get the dataset for changes
-prepare aupdate for dataadapter
-and update.
It is an IBM DB2 9.5 environment. I do use datareader select and populate,insert,update and dataset fill OK with IBM Oledb driver.
I appreciate any help
thanks
snky