C# 'int32 olan parametre değeri byte değerine dönüştürülemedi.' hatası

emiruzun4848

Kilopat
Katılım
5 Temmuz 2016
Mesajlar
127
Çözümler
1
Daha fazla  
Cinsiyet
Erkek
Kendimi geliştrmek için proje yapıyordum, şöyle bir hatayla karşılaştım'ınt32 olan parametre değeri byte değerine dönüştürülemedi.' ne yapmalıyım?
Olay şu arama koşulu diye bir cbox yaptım diğer datetimepicker labeller cboxlar görünmez, arama kşuluna göre görünür oluyorlar.

1660908660879.png


C#:
if (con.State == ConnectionState.Closed)
 con.Open();
 string komutisteme = "select * from Tablo_KHesap ";
 switch (p3_kosul1_CBox.SelectedIndex)
 {
 case 1:
 komutisteme = komutisteme + "where lokasyon=@lokasyon";
 break;
 case 2:
 komutisteme = komutisteme + "where Kguc=@tbox";
 break ;
 case 3:
 komutisteme = komutisteme + "where Gverim=@tinyinttbox";
 break;
 case 4:
 komutisteme = komutisteme + "where tkmw=@decimaltbox";
 break;
 case 5:
 komutisteme = komutisteme + "where tkgi=@decimaltbox";
 break;
 case 6:
 komutisteme = komutisteme + "where hbasla=@hbasla and hbitis=@hbitis";
 break;
 case 7:
 komutisteme = komutisteme + "where ksb=@tbox";
 break;
 case 8:
 komutisteme = komutisteme + "where fsb=@tbox";
 break;
 case 9:
 komutisteme = komutisteme + "where msb=@tbox";
 break;
 }
 com.Connection = con;
 com.CommandText = komutisteme;
 com.Parameters.Add("@lokasyon", SqlDbType.TinyInt).Value = p3_lokasyon_Cbox.SelectedIndex;
 com.Parameters.Add("@hbasla", SqlDbType.Date).Value = p3_kosul1Hbasla_DTP.Value.ToString("dd/MM/yyyy");
 com.Parameters.Add("@hbitis", SqlDbType.Date).Value = p3_kosul1Hbitis_DTP.Value.ToString("dd/MM/yyyy");
 com.Parameters.Add("@tinyinttbox", SqlDbType.TinyInt).Value = p3_kosul1arama_Tbox.Text.Trim();
 com.Parameters.Add("@decimaltbox", SqlDbType.Decimal).Value = p3_kosul1arama_Tbox.Text.Trim();
 com.Parameters.Add("@tbox", SqlDbType.TinyInt).Value = p3_kosul1arama_Tbox.Text.Trim();
 SqlDataAdapter da = new SqlDataAdapter(com);
 DataTable dt = new DataTable();
 da.Fill(dt);
 p3_Kayitlar_DGW.DataSource = dt;
 con.Close();

SQL ise şöyle.

1660908762887.png
 
Hangi kolonda hata veriyor hangi kolonun byte olarak kayıtlı?
1660909533000.png


SQL yapısının da SS ini atabilir misin hocam sana zahmet.

Mevcut tabloya sağ tık yap, edit top 200 rows olması lazım. Oradan SS at.

Hocam konuyu oluştururken attım

Hangi kolonda hata veriyor hangi kolonun byte olarak kayıtlı?
byte tanımlı yok tinyint tanımlı var
 

Geri
Yukarı