VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
hello pls help me how to solve this matter? pls? Posted by mamonize on 26 Sept 2012 at 9:48 PM
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:\Users\dell\Documents\Visual Studio 2005\Projects\CollectionAndBilling\Resources.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

Try

SConTole.Open()

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 & "')"


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

Else
MsgBox("Data already exist.")

End If
End While

SConTole.Close()

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


SConTole.Close()

End Sub
End Class



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.