AccessTr.neT
Ölçüt ifadesinde veri türü uyuşmazlığı. - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: Visual Basic .NET (https://accesstr.net/forum-visual-basic-net.html)
+--- Forum: Visual Basic .NET Örnekleri ve Uygulamaları (https://accesstr.net/forum-visual-basic-net-ornekleri-ve-uygulamalari.html)
+--- Konu Başlığı: Ölçüt ifadesinde veri türü uyuşmazlığı. (/konu-olcut-ifadesinde-veri-turu-uyusmazligi--11683.html)



Ölçüt ifadesinde veri türü uyuşmazlığı. - sako - 08/06/2011

Aşağıdaki kodda hata alıyorum.bir çözüm bulan var mı ?

"kayan" isimli alanım evet/hayır tipinde.

Dim urunadi, urunresim, eklenmetarihi As String
Dim KAYAN As Boolean

urunadi = urunaditext.Text
eklenmetarihi = Now
If kayanresimchk.Checked = "True" Then
KAYAN = True
Else
KAYAN = False
End If

If resimup.FileName = "" Then
urunresim = "urunler\" + "resimyok.jpg"
End If
If resimup.FileName <> "" Then
resimup.SaveAs(Server.MapPath("urunler\" + resimup.FileName))
urunresim = "urunler\" + resimup.FileName
End If

sorgu.Connection = baglanti
sorgu.CommandText = "insert into urunler(urunadi,eklenmetarihi,urunresim,kayan) values ('" & urunadi & "','" & eklenmetarihi & "','" & urunresim & "','" & KAYAN & "')"
sorgu.ExecuteNonQuery()


Cvp: Ölçüt ifadesinde veri türü uyuşmazlığı. - life_exciting - 08/06/2011

Aldığınız Hata Nedir?


Cvp: Ölçüt ifadesinde veri türü uyuşmazlığı. - sako - 08/06/2011

aldığım hata Ölçüt ifadesinde veri türü uyuşmazlığı.

checkbox kullanıyorum hata ondan kaynaklanıyor benim düşüncem. Ama nasıl gidreceğimi bulamadım...


Cvp: Ölçüt ifadesinde veri türü uyuşmazlığı. - Seruz - 08/06/2011

Gördüğüm kadarıyla;

If kayanresimchk.Checked = "True" Then
Burada tırnak işaretlerini kaldırıp deneyin.
If kayanresimchk.Checked = True Then

If resimup.FileName = "" Then
urunresim = "urunler\" + "resimyok.jpg"
End If
If resimup.FileName <> "" Then
resimup.SaveAs(Server.MapPath("urunler\" + resimup.FileName))
urunresim = "urunler\" + resimup.FileName
End If

Buradaki ifadelerde de + işareti yerine & işaretini kullanın.

If resimup.FileName = "" Then
urunresim = "urunler\" & "resimyok.jpg"
End If
If resimup.FileName <> "" Then
resimup.SaveAs(Server.MapPath("urunler\" & resimup.FileName))
urunresim = "urunler\" & resimup.FileName
End If