หน้าแรก
 การบ้าน
  C/C++ new
  Java new
  Windows Phone
  แจ้งเรื่องที่ต้องการ
 บทความ
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 แบบเรียนฟรี
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 ซอร์สโค้ด
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 บริการจากเรา
  เปิดท้าย... ขายโค้ด
  Freeware
  อัตราค่าโฆษณา
  รายชื่อลูกค้า
  สถิติผู้เข้าเว็บ
 ดาว์นโหลด
 ค้นหาข้อมูล
 กระดานสนทนา
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
  อื่นๆ
 กระดานงาน
 ลิงค์เว็บ
 เกี่ยวกับผม
 อัตราค่าโฆษณา
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
โปรแกรมเบอร์ดี (BerDee)
โปรแกรมเบอร์ดี (Android)
เกมส์เป่ายิ้งฉุบ
เกมส์เป่ายิ้งฉุบ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ติดต่อสอบถามมาได้ตลอดนะ...
2015-07-29 13:35:58
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:33:54
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:32:51
  ติดต่อสอบถามเข้ามาได้นะ...
2014-01-06 12:47:38
  ถ้ายังหาคนสอนไม่ได้ ก็ลอ...
2013-07-06 01:04:37
  สนใจส่งขอบเขตมาคุยราคาก...
2013-03-24 18:54:20
  ถ้ายังไม่มีคนรับงานติดต...
2012-12-16 19:18:14
  สนใจคะ ติดต่อ 0905076277...
2012-11-12 11:07:46
  รับทำโปรเจ็คนักศึกษาหรื...
2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  มาส่อง...
2024-08-19 15:45:12
  ช่วยเขียนโปรเจค: การควบค...
2024-08-07 09:13:31
  เขียนโปรแกรมภาษาจาวา
1.โ...

2023-09-12 11:40:28
  ต้องลอง debug ดูเองครับ
ไล่...

2023-06-08 18:03:06
  ร้านค้าแห่งหนึ่ง จะต้องน...
2021-09-21 08:47:08
  จงเขียนโปรแกรมดำเนินการ...
2021-05-07 15:06:11
  จงเขียนโปรแกรมสำหรับคำน...
2021-03-09 14:21:45
  ขอดู...
2021-01-04 23:56:45
  ขอโค้ดเพื่อทำการเรียนกา...
2020-12-09 23:02:09
  แล้ว ?...
2020-12-09 10:56:34
  Homework comment
  ขอโฟชาร์ตของโปรแกรมคำนว...
2025-02-27 13:31:36
  เขียนโปรแกรมเพื่อรับค่า...
2022-02-24 10:45:17
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  โจทย์การบ้าน c++ เขียนรูปแ...
2020-04-06 11:01:33
  แบบนี้ขอเป็น ภาษา php หน่อย...
2019-09-18 14:36:34
  ผมไม่อยากให้คุณได้คะแนน...
2019-04-27 01:29:07
  อาจารย์เขาบอกแนวข้อสอบม...
2019-04-27 00:44:29
  ขอสอบถามการเขียน c++ ครับ เ...
2018-04-02 12:19:21
  โค้ดตัวอย่างศึกษาให้เข้...
2017-11-26 14:50:05
  Article comment
  เท่าที่อ่าน error คือพื้นที่...
2022-03-23 13:56:48
  เรียน สอบถามปัญหา กับ อ.คร...
2022-01-24 17:39:49
  ต้องการ ให้เขียน โปรแกรม ...
2019-12-09 11:39:58
  รับเขียน arx จาก vc++ 2017 ล็อคโปร...
2019-09-19 09:48:09
  ทำการ register ไฟล์ที่ชื่อ mswinsck.oc...
2019-09-17 14:05:56
  ใน vb 6 ไม่มี component winsock เลยค่ะ ส...
2019-09-03 10:31:02
  รบกวนขอสอบถามหน่อยนะครั...
2019-03-04 05:31:04
  สามารถนำตัวหนังสือจากภา...
2018-12-25 08:54:32
  มีcode ของ VB ไหมค่ะ ถ้ามีรบกว...
2017-09-28 16:50:02
  น่าจะได้ครับ ไม่เคยลอง
...

2017-07-11 09:59:35
  9Mcode comment

Link Exchange

อัตราค่าโฆษณา
 
 Webboard

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

กระทู้ #1092 [อื่นๆ] (จาก IP: 124.120.62.51)

มีเรื่องรบกวนพี่ๆน้องๆผู้รู้หน่อยจ้า (ด่วนนะ) มือใหม่จ้า

เวลารันแล้วมันขึ้น error :: Syntax error in INSERT INTO statement นะจ๊ะ เขียนโค้ตดังนี้นะ ผิดตรงไหนหรือ
Imports System.Data
Imports System.Data.OleDb
Public Class FrmStartwork
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents BtnExit As System.Windows.Forms.Button
Friend WithEvents BtnSave As System.Windows.Forms.Button
Friend WithEvents BtnEdit As System.Windows.Forms.Button
Friend WithEvents BtnDelete As System.Windows.Forms.Button
Friend WithEvents BtnAddNew As System.Windows.Forms.Button
Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox
Friend WithEvents BtnSearch As System.Windows.Forms.Button
Friend WithEvents TxtSearch As System.Windows.Forms.TextBox
Friend WithEvents BtnLast As System.Windows.Forms.Button
Friend WithEvents BtnNext As System.Windows.Forms.Button
Friend WithEvents BtnPrev As System.Windows.Forms.Button
Friend WithEvents BtnFirst As System.Windows.Forms.Button
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents LbDate As System.Windows.Forms.Label
Friend WithEvents LbEmpId As System.Windows.Forms.Label
Friend WithEvents DTDate As System.Windows.Forms.DateTimePicker
Friend WithEvents DTWorkOut As System.Windows.Forms.DateTimePicker
Friend WithEvents DTWorkIn As System.Windows.Forms.DateTimePicker
Friend WithEvents LbWorkIn As System.Windows.Forms.Label
Friend WithEvents LbWorkOut As System.Windows.Forms.Label
Friend WithEvents TxtEmpID As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.BtnExit = New System.Windows.Forms.Button
Me.BtnSave = New System.Windows.Forms.Button
Me.BtnEdit = New System.Windows.Forms.Button
Me.BtnDelete = New System.Windows.Forms.Button
Me.BtnAddNew = New System.Windows.Forms.Button
Me.GroupBox4 = New System.Windows.Forms.GroupBox
Me.BtnSearch = New System.Windows.Forms.Button
Me.TxtSearch = New System.Windows.Forms.TextBox
Me.BtnLast = New System.Windows.Forms.Button
Me.BtnNext = New System.Windows.Forms.Button
Me.BtnPrev = New System.Windows.Forms.Button
Me.BtnFirst = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.LbWorkOut = New System.Windows.Forms.Label
Me.LbWorkIn = New System.Windows.Forms.Label
Me.DTDate = New System.Windows.Forms.DateTimePicker
Me.DTWorkOut = New System.Windows.Forms.DateTimePicker
Me.DTWorkIn = New System.Windows.Forms.DateTimePicker
Me.LbDate = New System.Windows.Forms.Label
Me.TxtEmpID = New System.Windows.Forms.TextBox
Me.LbEmpId = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.GroupBox2.SuspendLayout()
Me.GroupBox4.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.LightSteelBlue
Me.GroupBox2.Controls.Add(Me.BtnExit)
Me.GroupBox2.Controls.Add(Me.BtnSave)
Me.GroupBox2.Controls.Add(Me.BtnEdit)
Me.GroupBox2.Controls.Add(Me.BtnDelete)
Me.GroupBox2.Controls.Add(Me.BtnAddNew)
Me.GroupBox2.Location = New System.Drawing.Point(32, 88)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(384, 48)
Me.GroupBox2.TabIndex = 17
Me.GroupBox2.TabStop = False
'
'BtnExit
'
Me.BtnExit.BackColor = System.Drawing.Color.Gray
Me.BtnExit.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnExit.Location = New System.Drawing.Point(288, 16)
Me.BtnExit.Name = "BtnExit"
Me.BtnExit.Size = New System.Drawing.Size(64, 24)
Me.BtnExit.TabIndex = 12
Me.BtnExit.Tag = ""
Me.BtnExit.Text = "ปิด"
'
'BtnSave
'
Me.BtnSave.BackColor = System.Drawing.Color.Gray
Me.BtnSave.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnSave.Location = New System.Drawing.Point(224, 16)
Me.BtnSave.Name = "BtnSave"
Me.BtnSave.Size = New System.Drawing.Size(64, 24)
Me.BtnSave.TabIndex = 11
Me.BtnSave.Text = "บันทึกข้อมูล"
'
'BtnEdit
'
Me.BtnEdit.BackColor = System.Drawing.Color.Gray
Me.BtnEdit.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnEdit.Location = New System.Drawing.Point(160, 16)
Me.BtnEdit.Name = "BtnEdit"
Me.BtnEdit.Size = New System.Drawing.Size(64, 24)
Me.BtnEdit.TabIndex = 10
Me.BtnEdit.Text = "แก้ไขข้อมูล"
'
'BtnDelete
'
Me.BtnDelete.BackColor = System.Drawing.Color.Gray
Me.BtnDelete.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnDelete.Location = New System.Drawing.Point(96, 16)
Me.BtnDelete.Name = "BtnDelete"
Me.BtnDelete.Size = New System.Drawing.Size(64, 24)
Me.BtnDelete.TabIndex = 9
Me.BtnDelete.Text = "ลบข้อมูล"
'
'BtnAddNew
'
Me.BtnAddNew.BackColor = System.Drawing.Color.Gray
Me.BtnAddNew.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnAddNew.Location = New System.Drawing.Point(32, 16)
Me.BtnAddNew.Name = "BtnAddNew"
Me.BtnAddNew.Size = New System.Drawing.Size(64, 24)
Me.BtnAddNew.TabIndex = 8
Me.BtnAddNew.Text = "เพิ่มข้อมูล"
'
'GroupBox4
'
Me.GroupBox4.BackColor = System.Drawing.Color.LightSteelBlue
Me.GroupBox4.Controls.Add(Me.BtnSearch)
Me.GroupBox4.Controls.Add(Me.TxtSearch)
Me.GroupBox4.Controls.Add(Me.BtnLast)
Me.GroupBox4.Controls.Add(Me.BtnNext)
Me.GroupBox4.Controls.Add(Me.BtnPrev)
Me.GroupBox4.Controls.Add(Me.BtnFirst)
Me.GroupBox4.Location = New System.Drawing.Point(32, 352)
Me.GroupBox4.Name = "GroupBox4"
Me.GroupBox4.Size = New System.Drawing.Size(384, 56)
Me.GroupBox4.TabIndex = 15
Me.GroupBox4.TabStop = False
'
'BtnSearch
'
Me.BtnSearch.BackColor = System.Drawing.Color.Brown
Me.BtnSearch.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnSearch.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.BtnSearch.Location = New System.Drawing.Point(320, 16)
Me.BtnSearch.Name = "BtnSearch"
Me.BtnSearch.Size = New System.Drawing.Size(56, 32)
Me.BtnSearch.TabIndex = 10
Me.BtnSearch.Text = "Search"
'
'TxtSearch
'
Me.TxtSearch.Location = New System.Drawing.Point(176, 24)
Me.TxtSearch.Name = "TxtSearch"
Me.TxtSearch.Size = New System.Drawing.Size(136, 20)
Me.TxtSearch.TabIndex = 9
Me.TxtSearch.Text = ""
'
'BtnLast
'
Me.BtnLast.BackColor = System.Drawing.Color.Brown
Me.BtnLast.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnLast.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.BtnLast.Location = New System.Drawing.Point(128, 16)
Me.BtnLast.Name = "BtnLast"
Me.BtnLast.Size = New System.Drawing.Size(40, 32)
Me.BtnLast.TabIndex = 8
Me.BtnLast.Text = ">>"
'
'BtnNext
'
Me.BtnNext.BackColor = System.Drawing.Color.Brown
Me.BtnNext.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnNext.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.BtnNext.Location = New System.Drawing.Point(88, 16)
Me.BtnNext.Name = "BtnNext"
Me.BtnNext.Size = New System.Drawing.Size(40, 32)
Me.BtnNext.TabIndex = 7
Me.BtnNext.Text = ">"
'
'BtnPrev
'
Me.BtnPrev.BackColor = System.Drawing.Color.Brown
Me.BtnPrev.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnPrev.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.BtnPrev.Location = New System.Drawing.Point(48, 16)
Me.BtnPrev.Name = "BtnPrev"
Me.BtnPrev.Size = New System.Drawing.Size(40, 32)
Me.BtnPrev.TabIndex = 6
Me.BtnPrev.Text = "<"
'
'BtnFirst
'
Me.BtnFirst.BackColor = System.Drawing.Color.Brown
Me.BtnFirst.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.BtnFirst.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.BtnFirst.Location = New System.Drawing.Point(8, 16)
Me.BtnFirst.Name = "BtnFirst"
Me.BtnFirst.Size = New System.Drawing.Size(40, 32)
Me.BtnFirst.TabIndex = 5
Me.BtnFirst.Text = "<<"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.LightSteelBlue
Me.GroupBox1.Controls.Add(Me.LbWorkOut)
Me.GroupBox1.Controls.Add(Me.LbWorkIn)
Me.GroupBox1.Controls.Add(Me.DTDate)
Me.GroupBox1.Controls.Add(Me.DTWorkOut)
Me.GroupBox1.Controls.Add(Me.DTWorkIn)
Me.GroupBox1.Controls.Add(Me.LbDate)
Me.GroupBox1.Controls.Add(Me.TxtEmpID)
Me.GroupBox1.Controls.Add(Me.LbEmpId)
Me.GroupBox1.Location = New System.Drawing.Point(32, 136)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(384, 216)
Me.GroupBox1.TabIndex = 14
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "ข้อมูลการทำงาน"
'
'LbWorkOut
'
Me.LbWorkOut.BackColor = System.Drawing.Color.Transparent
Me.LbWorkOut.Font = New System.Drawing.Font("Miriam Transparent", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.LbWorkOut.Location = New System.Drawing.Point(64, 144)
Me.LbWorkOut.Name = "LbWorkOut"
Me.LbWorkOut.Size = New System.Drawing.Size(72, 32)
Me.LbWorkOut.TabIndex = 32
Me.LbWorkOut.Text = "เวลาออก"
Me.LbWorkOut.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'LbWorkIn
'
Me.LbWorkIn.BackColor = System.Drawing.Color.Transparent
Me.LbWorkIn.Font = New System.Drawing.Font("Miriam Transparent", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.LbWorkIn.Location = New System.Drawing.Point(64, 104)
Me.LbWorkIn.Name = "LbWorkIn"
Me.LbWorkIn.Size = New System.Drawing.Size(72, 32)
Me.LbWorkIn.TabIndex = 31
Me.LbWorkIn.Text = "เวลาเข้า"
Me.LbWorkIn.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'DTDate
'
Me.DTDate.Location = New System.Drawing.Point(176, 64)
Me.DTDate.Name = "DTDate"
Me.DTDate.Size = New System.Drawing.Size(136, 20)
Me.DTDate.TabIndex = 30
'
'DTWorkOut
'
Me.DTWorkOut.Format = System.Windows.Forms.DateTimePickerFormat.Time
Me.DTWorkOut.Location = New System.Drawing.Point(176, 144)
Me.DTWorkOut.Name = "DTWorkOut"
Me.DTWorkOut.ShowUpDown = True
Me.DTWorkOut.Size = New System.Drawing.Size(136, 20)
Me.DTWorkOut.TabIndex = 29
'
'DTWorkIn
'
Me.DTWorkIn.Format = System.Windows.Forms.DateTimePickerFormat.Time
Me.DTWorkIn.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.DTWorkIn.Location = New System.Drawing.Point(176, 104)
Me.DTWorkIn.Name = "DTWorkIn"
Me.DTWorkIn.ShowUpDown = True
Me.DTWorkIn.Size = New System.Drawing.Size(136, 20)
Me.DTWorkIn.TabIndex = 28
'
'LbDate
'
Me.LbDate.BackColor = System.Drawing.Color.Transparent
Me.LbDate.Font = New System.Drawing.Font("Miriam Transparent", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.LbDate.Location = New System.Drawing.Point(64, 64)
Me.LbDate.Name = "LbDate"
Me.LbDate.Size = New System.Drawing.Size(72, 32)
Me.LbDate.TabIndex = 4
Me.LbDate.Text = "วันที่"
Me.LbDate.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TxtEmpID
'
Me.TxtEmpID.Location = New System.Drawing.Point(176, 24)
Me.TxtEmpID.Name = "TxtEmpID"
Me.TxtEmpID.Size = New System.Drawing.Size(136, 20)
Me.TxtEmpID.TabIndex = 3
Me.TxtEmpID.Text = ""
'
'LbEmpId
'
Me.LbEmpId.BackColor = System.Drawing.Color.Transparent
Me.LbEmpId.Font = New System.Drawing.Font("Miriam Transparent", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.LbEmpId.Location = New System.Drawing.Point(64, 24)
Me.LbEmpId.Name = "LbEmpId"
Me.LbEmpId.Size = New System.Drawing.Size(72, 32)
Me.LbEmpId.TabIndex = 2
Me.LbEmpId.Text = "รหัสพนักงาน"
Me.LbEmpId.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.SteelBlue
Me.Label2.Font = New System.Drawing.Font("Miriam Fixed", 21.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.Label2.Location = New System.Drawing.Point(32, 40)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(384, 48)
Me.Label2.TabIndex = 16
Me.Label2.Text = "ข้อมูลการทำงาน"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.BottomCenter
'
'FrmStartwork
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Silver
Me.ClientSize = New System.Drawing.Size(448, 462)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox4)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Label2)
Me.Name = "FrmStartwork"
Me.Text = "HR_Payroll 2007 โปรแกรมจัดการบุคคลและการจ่ายเงินเดือน"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox4.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region
Dim CN As OleDbConnection
Dim DA As OleDbDataAdapter
Dim DS As New DataSet
Dim i As Int16 = 0
Dim status As String
Public Sub openDB()
Try
CN = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HR_Payroll2007\HR_Payroll2007.MDB")
Dim SQL As String
CN.Open()
SQL = "Select * From TblStartWork "
DA = New OleDbDataAdapter(SQL, CN)
DA.Fill(DS, "TblStartWork")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub showData()

Try
TxtEmpID.Text = DS.Tables("TblStartWork").Rows(i)("EmpID")
DTDate.Value = DS.Tables("TblStartWork").Rows(i)("Date")
DTWorkIn.Value = DS.Tables("TblStartWork").Rows(i)("WorkIn")
DTWorkOut.Value = DS.Tables("TblStartWork").Rows(i)("WorkOut")
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Public Sub LockControls(ByVal flag As Boolean)
If flag Then
TxtEmpID.Enabled = False
DTDate.Enabled = False
DTWorkIn.Enabled = False
DTWorkOut.Enabled = False
BtnFirst.Enabled = True
BtnPrev.Enabled = True
BtnNext.Enabled = True
BtnLast.Enabled = True
Else
TxtEmpID.Enabled = True
DTDate.Enabled = True
DTWorkIn.Enabled = True
DTWorkOut.Enabled = True
BtnFirst.Enabled = False
BtnPrev.Enabled = False
BtnNext.Enabled = False
BtnLast.Enabled = False
End If
End Sub
Public Sub AddNewData()
Dim dr1 As DataRow
Try
Dim cmb As New OleDbCommandBuilder(DA)
dr1 = DS.Tables("TblStartWork").NewRow
dr1("EmpID") = TxtEmpID.Text
dr1("Date") = DTDate.Value
dr1("WorkIn") = DTWorkIn.Value
dr1("WorkOut") = DTWorkOut.Value
DS.Tables("TblStartWork").Rows.Add(dr1)
DA.Update(DS, "TblStartWork")
MsgBox("บันทึกข้อมูลเรียบร้อยแล้ว")
Catch ex As Exception
MsgBox("error :: " & ex.Message)
Finally

End Try
End Sub
Public Sub EditData()
Try
Dim cmb As New OleDbCommandBuilder(DA)
DS.Tables("TblStartWork").Rows(i)("EmpID") = TxtEmpID.Text
DS.Tables("TblStartWork").Rows(i)("Date") = DTDate.Value
DS.Tables("TblStartWork").Rows(i)("WorkIn") = DTWorkIn.Value
DS.Tables("TblStartWork").Rows(i)("WorkOut") = DTWorkOut.Value
DA.Update(DS, "TblStartWork")
MsgBox("Update Comlete")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub FrmStartwork_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
openDB()
showData()
BtnSave.Enabled = False
LockControls(True)
End Sub

Private Sub BtnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst.Click
i = 0
showData()
End Sub

Private Sub BtnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrev.Click
If i > 0 Then
i -= 1
Else
MsgBox("ไม่สามารถไปเรคคอร์ดก่อนหน้าได้ " & vbCrLf & "เนื่องจากเป็นแถวแรกสุด !")
End If
showData()
End Sub

Private Sub BtnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNext.Click
If i < DS.Tables("TblStartWork").Rows.Count - 1 Then
i += 1
Else
MsgBox("ไม่สามารถไปเรคคอร์ดถัดไปได้" & vbCrLf & " เนื่องจากเป็นเรคคอร์ดสุดท้ายแล้ว ! ")
End If
showData()
End Sub

Private Sub BtnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLast.Click
i = DS.Tables(0).Rows.Count - 1
showData()
End Sub

Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
Dim keysearch As String
keysearch = TxtSearch.Text
For k As Int16 = 0 To DS.Tables(0).Rows.Count - 1
If keysearch = DS.Tables(0).Rows(k)("empid") Then
i = k
showData()

Exit For
Else
End If
Next k
End Sub

Private Sub BtnAddNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddNew.Click
status = "addnew"
LockControls(False)
TxtEmpID.Clear()
DTDate.Value = Today
DTWorkIn.Value = Today
DTWorkOut.Value = Today
TxtEmpID.Focus()
BtnAddNew.Enabled = False
BtnSave.Enabled = True
End Sub

Private Sub BtnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDelete.Click
Dim msgresult As MsgBoxResult
msgresult = MsgBox("คุณต้องการลบข้อมูลนี้ใช่หรือไม่", MsgBoxStyle.YesNoCancel, "HR_Payroll2007")
If msgresult = MsgBoxResult.Yes Then
Dim cmb As New OleDbCommandBuilder(DA)
DS.Tables("TblStartWork").Rows(i).Delete()
DA.Update(DS, "TblStartWork")
Else

End If
End Sub

Private Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click
LockControls(False)
BtnEdit.Enabled = False
BtnSave.Enabled = True
status = "edit"
End Sub

Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSave.Click
If status = "addnew" Then
AddNewData()
BtnAddNew.Enabled = True
BtnSave.Enabled = False
LockControls(True)
ElseIf status = "edit" Then
EditData()
BtnEdit.Enabled = True
BtnSave.Enabled = False
LockControls(True)
End If
End Sub

Private Sub BtnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExit.Click
Dim msgresult As MsgBoxResult
msgresult = MsgBox("คุณต้องการออกจากโปรแกรมหรือไม่", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Question, "HR_Payroll2007")
If msgresult = MsgBoxResult.Yes Then
Me.Close()
Else

End If
End Sub

Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

End Sub
End Class
จากคุณ : g [2007-05-21 10:43:37]  

58.8.88.209 ความคิดเห็น #25540 (จาก IP: 58.8.88.209)
เวลารันแล้วมันขึ้น error :: Syntax error in INSERT INTO statement

error มันก็บอกนะ รูปแบบคำสั่ง insert into ผิด ก็มอง ๆ หา นะว่า insert into มันอยู่ตรงไหนก็ไม่เจอเลยในส่วนของโปรแกรมที่ส่งมา

เข้าใจว่าหน้าจะอยู่ในส่วนอื่น ๆ มากกว่า ลอง Ctrl+F แล้วค้นหา ดูนะว่ามันอยู่ตรงไหน
จากคุณ : ron-korn@hotmail.com [2007-05-21 23:00:49]

124.120.64.82 ความคิดเห็น #25543 (จาก IP: 124.120.64.82)
ขอบคุณนะจ๊ะ
จากคุณ : g [2007-05-22 21:31:48]
ตอบกระทู้
  • ห้ามการโฆษณา หากต้องการติดต่อหาลูกค้า ติดต่อโฆษณาโดยตรงได้ที่ webmaster@sourcecode.in.th
  • ห้ามใช้คำหยาบและคำพูดที่ไม่เหมาะสม
  • ขอสงวนสิทธิหากตรวจพบ ข้อความที่ไม่เหมาะสม ข้อความนั้นจะถูกลบทันที
ชื่อ
อีเมล์
รายละเอียด

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

 
 
คลิปสอนเขียนโปรแกรม
เรียนเขียนโปรแกรมดอทเน็ต
เรียนเขียนโปรแกรมแอนดรอยด์
เรียนเขียนโปรแกรมเบล็คเบอร์รี่
เรียนเขียนโปรแกรมซี ซีพลัสพลัส
เรียนเขียนโปรแกรมจาวา
เรียนการใช้งานลินุกส์
เรียนการเขียนโปรแกรมวินโดว์โฟน
เรียนการเขียนโปรแกรมพีเฮชพี มายเอสคิวเอล
อัตราค่าโฆษณา
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
แบบสำรวจ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

สงวนลิขสิทธิ์ ห้ามคัดลอก ทำซ้ำ แก้ไข ดัดแปลง ไม่ว่าในรูปแบบใด โดยไม่ได้รับอนุญาตเป็นลายลักษณ์อักษร
เลขทะเบียนพาณิชย์อิเล็กทรอนิกส์จากกระทรวงพาณิชย์: 7100503002000
Copyright 2001 SourceCode.in.th