Selamat malam , kali ini saya akan membuat program
penjualan jus menggunakan aplikasi
virtual basic dan membuat database pada ms.access akan tetapi di sini agak
sederhana sekali programnya, sehingga perlu di ketik pada websitenya lalu di
simpan, kita simak saja programnya.
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Partial Class efril_
Inherits System.Web.UI.Page
Dim constring As String = ConfigurationManager.ConnectionStrings("efrilConnectionString").ConnectionString
Dim xReader As OleDbDataReader
Dim oConn As New OleDbConnection(constring)
Dim Sql As String
Protected Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
End Sub
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim Sql As String = "DELETE FROM Customer where namapaket = ('" & TextBox1.Text & "');"
Dim oCmd As New OleDbCommand
oConn.Open()
oCmd.Connection = oConn
oCmd.CommandText = Sql
oCmd.ExecuteNonQuery()
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Response.Redirect("efril")
End Sub
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim sql As String = "INSERT INTO Customer VALUES ('" & TextBox2.Text & "','" & TextBox1.Text & "','" & TextBox3.Text & "');"
Dim oCmd As New OleDbCommand
oConn.Open()
oCmd.Connection = oConn
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Not Len(TextBox1.Text) = 0 Then
oConn.Close()
oConn.Open()
Dim ocmd As New OleDbCommand("SELECT * FROM Customer where namapaket='" + TextBox1.Text + "'", oConn)
xReader = ocmd.ExecuteReader
If xReader.HasRows Then
xReader.Read()
TextBox2.Text = xReader("codepaket")
TextBox3.Text = xReader("harga")
Else
TextBox2.Text = "Nama Barang Tidak Ada"
End If
End If
End Sub
End Class