MS SQL Veri tabanlı Kargo Takip Programı — VB.NET
Not : Mssql (2012) veri tabanı backup dosyası projenin içinde mevcuttur.
FORM1 İçerisine Yazılacak Kodlar…
Kod:
Imports System.Data.SqlClient
Public Class Form1
Public bag As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=Data;Integrated Security=True")
Public kmt As New SqlCommand
Public adtr As New SqlDataAdapter İ
Public dtst As New DataSet()
Public Sub listelesene()
bag.Open()
Dim adtr As New SqlDataAdapter("Select * From Musbil", bag)
adtr.Fill(dtst, "Musbil")
Form2.dataView1.Table = dtst.Tables(0)
Form2.dataGrid1.DataSource = Form2.dataView1
adtr.Dispose()
bag.Close()
End Sub
Public Sub listelesene2()
bag.Open()
Dim adtr As New SqlDataAdapter("Select * From yetkili", bag)
adtr.Fill(dtst, "yetkili")
Form3.dataView1.Table = dtst.Tables(1)
Form3.dataGrid1.DataSource = Form3.dataView1
adtr.Dispose()
bag.Close()
End Sub
Public Sub listelesene3()
bag.Open()
Dim adtr As New SqlDataAdapter("Select * From Fiyat", bag)
adtr.Fill(dtst, "Fiyat")
Form4.dataView1.Table = dtst.Tables(2)
Form4.dataGrid1.DataSource = Form4.dataView1
adtr.Dispose()
bag.Close()
End Sub
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Form2.ShowDialog()
End Sub
Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click
Form5.ShowDialog()
End Sub İ
Private Sub button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click
Close()
End Sub
End Class
FORM2 İçerisine Yazılacak Kodlar…
Kod:
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form1.listelesene()
End Sub
Private Sub button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button11.Click
Close()
End Sub
Private Sub button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button10.Click
If textBox1.Text <> "" AndAlso textBox4.Text <> "" AndAlso textBox5.Text <> "" Then
Form1.bag.Open()
Form1.kmt.Connection = Form1.bag
Form1.kmt.CommandText = (((((((("INSERT INTO musbil(MüsteriNo,Ad,Soyad,TcKimlik,SeriNo,Ceptel,Evtel,Email,Adres) VALUES (İ" + textBox1.Text & "İ,İ") + textBox2.Text & "İ,İ") + textBox3.Text & "İ,İ") + textBox4.Text & "İ,İ") + textBox5.Text & "İ,İ") + textBox6.Text & "İ,İ") + textBox7.Text & "İ,İ") + textBox8.Text & "İ,İ") + textBox9.Text & "İ) "
Form1.kmt.ExecuteNonQuery()
Form1.kmt.Dispose()
Form1.bag.Close()
Form1.dtst.Clear()
textBox1.Clear()
textBox2.Clear()
textBox3.Clear()
textBox4.Clear()
textBox5.Clear()
textBox6.Clear()
textBox7.Clear()
textBox8.Clear()
textBox9.Clear()
Form1.listelesene()
MessageBox.Show("Kayıt işlemi tamamlandı ! ")
Else
MessageBox.Show("Boş alanları doldurunuz !!!")
End If
End Sub
Private Sub button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button12.Click
Form3.Show()
Me.Hide()
End Sub
Private Sub button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button13.Click
If textBox1.Text <> "" Then
Dim cevap As DialogResult
cevap = MessageBox.Show("Kaydı silmek istediğinizden eminmisiniz", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If cevap = DialogResult.Yes Then
Form1.bag.Open()
Form1.kmt.Connection = Form1.bag
Form1.kmt.CommandText = "DELETE from Musbil WHERE MüsteriNo=İ" + textBox1.Text & "İ"
Form1.kmt.ExecuteNonQuery()
Form1.kmt.Dispose()
Form1.bag.Close()
Form1.dtst.Clear()
Form1.listelesene()
End If
Else
MessageBox.Show("Müşteri No'yu giriniz")
End If
End Sub
End Class
0 yorum:
Yorum Gönder