Imports System.Data.SqlClient
Public Class frmSlip27
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim datadapter As New SqlDataAdapter
Dim dt As New DataTable
Dim cnt As New Integer
Dim str As String
Private Sub cmdNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNew.Click
txtP_Id.Clear()
txtP_Name.Clear()
txtExp.Clear()
txtPrice.Clear()
txtP_Id.Focus()
End Sub
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
cn = New SqlConnection("Data Source=BHUSHAN\sqlexpress;Initial Catalog=product2;Integrated Security=True;Pooling=False")
cn.Open()
str = "insert into product2 values (" & CInt(txtP_Id.Text) & " , '" & txtP_Name.Text & "', '" & txtExp.Text & "', " & CInt(txtPrice.Text) & ")"
cmd = New SqlCommand(str, cn)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
MsgBox("Record Inserted Successfully")
End If
End Sub
Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click
Form2.Show()
End Sub
End Class