VB .NET

VB .NET

Slip28

Q.1) Write a VB.NET program to accept the details Supplier (SupId, SupName, Phone_No, Address ) store it into the database and display it. (Use Crystal Report) [Marks 20] 

Solution

Public Class frmSlip28
Dim con As New OleDb.OleDbConnection
Dim cmd As New OleDb.OleDbCommand
Dim cnt As Integer
Dim str As String
Private Sub cmdNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNew.Click
txtS_Id.Clear()
txtS_Name.Clear()
txtContact.Clear()
txtAddr.Clear()
txtS_Id.Focus()
End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
con = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\VB.NET\slip28\supplier.accdb")
con.Open()
str = "insert into supplier values (" & CInt(txtS_Id.Text) & ",'" & txtS_Name.Text & "','" & txtContact.Text & "','" & txtAddr.Text & "')"
cmd = New OleDb.OleDbCommand(str, con)
cnt = cmd.ExecuteNonQuery
If (cnt > 0) Then
MsgBox("Record Inserted Successfully")
End If
con.Close()
End Sub
Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click
frmReport.Show()
End Sub
End Class

BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

Post a Comment

Previous Post Next Post