Private Sub btnOKDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOKDate.Click
Dim dates As String
dates = DT1.Value.Month & "/" & DT1.Value.Day & "/" & DT1.Value.Year & " " & "00:00:00"
If txtsm.Text = "" Then
MsgBox("กรุณาใส่ภาคเรียนด้วย")
Else
Dim sql As String = "INSERT INTO datacard (stu_id,semester,day_no,day,dates) SELECT stu_id,semester,'" & Day_no & "','" & days & "','" & dates & "' FROM student where semester = '" & txtsm.Text & "' and insert_Datacard like '1' "
connectdb()
Dim cm As New SqlCommand(sql, cn)
cm.ExecuteNonQuery()
closedb()
MsgBox("สร้างตารางตามวันที่กำหนดเรียบร้อยแล้ว")
End If
End Sub
Tag : .NET, MySQL, Ms SQL Server 2005, VB.NET, VS 2005 (.NET 2.x)