hello pls help me how to solve this matter? pls? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

hello pls help me how to solve this matter? pls?

mamonizemamonize Posts: 3Member
i am a beginner programmer and i have some problem regarding with avoiding data duplication, based on the Sales invoice no. this is sample of my codes.

Imports System.Data.OleDb

Public Class Form1
Dim SconT As String = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:UsersdellDocumentsVisual Studio 2005ProjectsCollectionAndBillingResources.accdb")
Dim SConTole As New OleDbConnection(SconT)
Dim ConS As String

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click



Dim Command As New OleDbCommand(ConS, SConTole)
Dim dr As OleDbDataReader = Command.ExecuteScalar()

While dr.Read()
If dr.Item("SalesInv") <> txtBillingNumber.Text Then

ConS = "Insert Into InData([CoName],[Reciever],[BldgName],[CoAddrss],[SalesInv],[RefNo],[FileDate],[Position],[PayRefNo],[PeriodCA],[PBAASF],[VAT],[Total],[SubTotal],[TAmount])" & " Values ('" & txtClientName.Text & "','" & TextReciever.Text & "','" & txtArea.Text & "','" & txtAddress.Text & "','" & txtBillingNumber.Text & "','" & txtContactRefNo.Text & _
"','" & DTPFile.Text & "','" & txtCC.Text & "','" & txtPayrollReference.Text & " ','" & txtPeriod.Text & "','" & txtPaBeAllASF.Text & "','" & txtVAT.Text & "','" & txtTotal1.Text & "','" & txtTotal2.Text & "','" & txtTotalAmount.Text & "')"

MsgBox("Data has been added.", MsgBoxStyle.Information)

MsgBox("Data already exist.")

End If
End While


Catch ex As Exception
MsgBox("Cannot Process.")
End Try


End Sub
End Class
Sign In or Register to comment.