Arama butonu
Bu konudaki kullanıcılar: 1 misafir
3
Cevap
4706
Tıklama
0
Öne Çıkarma
VB.NET Veritabanı Update Etme
A
15 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 >



A
15 yıl
Yarbay
Konu Sahibi

G
15 yıl
Çavuş

arkadaşım sorunu çözdüysen eğer prg linkibni upload edebilirmisin pm atarsan çok şii olur kardeşim neyse ii akşamlar



P
15 yıl
Yüzbaşı

quote:

Orjinalden alıntı: okanbozkurts

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 >



UZun zamandan beri SQL Kodları ile uğraşmıyordum eğer kodlarımı bulursam sana yollarım ve bana eğer bu program ve kodlarını upload edip yollarsan sorunu çözebilirsem sana geri yollarım

yada update' i boş ver programı doğruca tekrar yaz lazım olan yere yolla bu kadar uğraştığına değmez





< Bu mesaj bu kişi tarafından değiştirildi Proob -- 22 Mart 2009; 18:33:25 >

DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.