- Home
·
- Miscellaneous
·
- Code to accept the details of Customer , Update ,Delete them & to Save in the Database . Also to vi
Code to accept the details of Customer , Update ,Delete them & to Save in the Database . Also to vi
Code to accept the details of Customer , Update ,Delete them & to Save in the Database . Also to view the list of Customers`
Rate Code to accept the details of Customer , Update ,Delete them & to Save in the Database . Also to vi
(1(1 Vote))
Dim comCustomers As Command
Dim rstCustomers As Recordset
Dim intStatus As Integer
Dim intPosition As Integer
Private Sub Form_Load()
Set conOnlineBanking = New Connection
Set comCustomers = New Command
Set rstCustomers = New Recordset
With conOnlineBanking
.ConnectionString = "User Id = sa ;password=;Data Source = mr1-pdc-ddr;Initial Catalog = OnlineBanking"
.Provider = "SQLOLEDB"
.Open
End With
comCustomers.ActiveConnection = conOnlineBanking
rstCustomers.Open "select * from customers", conOnlineBanking, adOpenDynamic, adLockOptimistic
Call FillList
Call Display
End Sub
Private Sub cmdNew_Click()
For Each Control In Customers
If TypeOf Control Is TextBox Then
Control.Text = " "
txtCode.SetFocus
End If
Next
rstCustomers.AddNew
'Call Allow
End Sub
Private Sub cmdSave_Click()
intStatus = 1
For Each Control In Customers
If TypeOf Control Is TextBox Then
If Control.Text = " " Then
MsgBox "Incomplete data"
intStatus = 0
Exit For
End If
End If
Next
If intStatus = 1 Then
rstCustomers("cCustomerCode") = txtCode.Text
rstCustomers("vName") = txtName.Text
rstCustomers("cTelephoneNo") = txttelNo.Text
rstCustomers("cFaxNo") = txtFaxNo.Text
rstCustomers("cEmailId") = txtEmailId.Text
rstCustomers("ddate") = txtDate.Text
rstCustomers("cAmount") = txtAmount.Text
rstCustomers.Update
Call FillList
'Call Disallow
End If
End Sub
Private Sub cmdUpdate_Click()
'Call Allow
End Sub
Private Sub cmdDelete_Click()
rstCustomers.Delete
rstCustomers.MoveNext
If rstCustomers.EOF Then rstCustomers.MoveLast
Call Display
Call FillList
End Sub
Private Sub lstCustomerName_Click()
intPosition = lstCustomerName.ListIndex
rstCustomers.MoveFirst
rstCustomers.Move intPosition
Call Display
End Sub
Private Sub Display()
txtCode = rstCustomers("cCustomerCode")
txtName = rstCustomers("vName")
txttelNo = rstCustomers("cTelephoneNo")
txtFaxNo = rstCustomers("cFaxNo")
txtEmailId = rstCustomers("cEmailId")
txtDate = rstCustomers("ddate")
txtAmount = rstCustomers("cAmount")
End Sub
Private Sub FillList()
lstCustomerName.Clear
rstCustomers.Requery
rstCustomers.MoveFirst
Do While Not rstCustomers.EOF
lstCustomerName.AddItem rstCustomers("cCustomerCode")
rstCustomers.MoveNext
Loop
rstCustomers.MoveFirst
Call Display
End Sub
Code to accept the details of Customer , Update ,Delete them & to Save in the Database . Also to vi Comments
No comments yet — be the first to post one!
Post a Comment