Coding VB SQL 2

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Imports System.

Data
Imports System.Data.SqlClient
Public Class FormTest
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim da As SqlDataAdapter
Dim tbl As New DataTable

Sub record(ByVal search As String)


conn = New SqlConnection("server=DESKTOP-FRN8RA7\SQLEXPRESS;user
id=PARKING;password=parkir123;database=PARKING;")
Dim query As String = "select * from status_parkir"
cmd = New SqlCommand(query, conn)
Dim da = New SqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

End Sub

Private Sub FormTest_Load(sender As System.Object, e As System.EventArgs)


Handles MyBase.Load
record("")

End Sub

Private Sub ButtonInsert_Click(sender As System.Object, e As System.EventArgs)


Handles ButtonInsert.Click
Dim query As String = "insert"
conn.Open()

End Sub
End Class

===================================================================================
=====================================
("insert into status_parkir (slot,status) values('"+textboxname.text
+"','"+textboxslot.text +"')", conn)

You might also like