Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > บทความจากสมาชิก > VB.Net ป้องกันการบันทึก (Insert) ข้อมูลซ้ำ



 
Clound SSD Virtual Server

VB.Net ป้องกันการบันทึก (Insert) ข้อมูลซ้ำ

VB.Net ป้องกันการบันทึก (Insert) ข้อมูลซ้ำ เป็นอีกแนวทางในการตรวจสอบข้อมูลก่อนการบึนทึก เพื่อป้องกันการบันทึกข้อมูลซ้ำ

Code (VB.NET)
'การเรียกใช้
    If Check(txtT1) = True Then
            MessageBox.Show("บันทึกข้อมูลซ้ำ  !!! กรุณาตรวจสอบอีกครั้ง", "ผลการทำงาน", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Exit Sub
        End If



Code (VB.NET)
'ฟังก์ชั่น
  Public Function Check(ByVal Search As String) As Boolean
        Dim strConn As String
        strConn = DBConnString.strConn
        Conn = New SqlConnection()
        With Conn
            If .State = ConnectionState.Open Then .Close()
            .ConnectionString = strConn
            .Open()
        End With
        Dim da As New SqlDataAdapter
        sb = New StringBuilder
        sb.Remove(0, sb.Length())
        sb.Append("SELECT T1 FROM  Table1 ")
        sb.Append(" WHERE (T1 = '" & Search & "')")
        Dim Sqlmccode As String = sb.ToString()
        Dim ds As New DataSet()
        da = New SqlDataAdapter(Sqlmccode, Conn)
        da.SelectCommand.CommandText = Sqlmccode
        da.Fill(ds , "Table1")
        If ds .Tables("Table1").Rows.Count <> 0 Then
            Return True
        Else
            Return False
        End If
    End Function


วิดีโอตัวอย่าง



https://youtu.be/f-Q--MpFGMw

ภาพที่1

ภาพที่2

ภาพที่3


Reference : http://tum





   
Share
Bookmark.   

  By : DUL
  Article : บทความเป็นการเขียนโดยสมาชิก หากมีปัญหาเรื่องลิขสิทธิ์ กรุณาแจ้งให้ทาง webmaster ทราบด้วยครับ
  Score Rating :
  Create Date : 2017-02-15
  Download : No files
Sponsored Links
ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่