Arama butonu
Bu konudaki kullanıcılar: 1 misafir, 1 mobil kullanıcı
3
Cevap
4729
Tıklama
0
Öne Çıkarma
VB.NET Veritabanı Update Etme
A
16 yıl
Yarbay
Konu Sahibi

Arkadaşlar bir sorunum var benim amacım veritabına kayıtlı olan veriyi vb' de güncellemek ancak bazı sorunlarım var internette biraz araştırdım ama anlayacağım bilgilere ulaşamadım.

Kodlar;
Dim baglanti As New OleDbConnection
Dim komut As New OleDbCommand
Dim adp As New OleDbDataAdapter
Dim ds As New DataSet

baglanti.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=C:\Ogrenci\Ogrenci.mdb"
baglanti.Open()

komut.CommandType = CommandType.Text
If CheckBox1.Checked = True Then
komut.CommandText = "Update Ogrenci Set ogrenci_adi='" & TextBox1.Text & "' Where ogrenci_no='" & Val(TextBox3.Text) & "'"
ElseIf CheckBox2.Checked = True Then
komut.CommandText = "Update Ogrenci Set ogrenci_soyadi='" & TextBox2.Text & "' Where ogrenci_no='" & Val(TextBox3.Text) & "'"
ElseIf CheckBox4.Checked = True Then
komut.CommandText = "Update Ogrenci Set ogrenci_cinsiyeti='" & CheckBox5.Checked & "' Where ogrenci_no='" & Val(TextBox3.Text) & "'"
ElseIf CheckBox1.Checked = True And CheckBox2.Checked = True Then
komut.CommandText = "Update Ogrenci Set ogrenci_adi='" & TextBox1.Text & "', ogrenci_soyadi='" & TextBox2.Text & "' Where ogrenci_no='" & Val(TextBox3.Text) & "'"
ElseIf CheckBox1.Checked = True And CheckBox4.Checked = True Then
komut.CommandText = "Update Ogrenci Set ogrenci_adi='" & TextBox1.Text & "', ogrenci_cinsiyeti='" & CheckBox5.Checked & "' Where ogrenci_no='" & Val(TextBox3.Text) & "'"
ElseIf CheckBox2.Checked = True And CheckBox4.Checked = True Then
komut.CommandText = "Update Ogrenci Set ogrenci_soyadi='" & TextBox2.Text & "', ogrenci_cinsiyeti='" & CheckBox5.Checked & "' Where ogrenci_no='" & Val(TextBox3.Text) & "'"
End If

komut.Connection = baglanti


kodlar bu şekilde bir eksikliğinin olduğunu ben de biliyorum ama bilgim kıt olduğu için yapamıyorum sanırsam sql cümleciklerinde sorun yok ama ondan sonra kullanacağım kodları bilmiyorum, form ekranının resmini de ekledim.

Yardımcı olan herkese şimdiden teşekkür ederim.

< Resime gitmek için tıklayın >

DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.

Üye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.

Üye Ol Şimdi Değil