Home > Net >  Ask: about VB.NET form to access database operation time
Ask: about VB.NET form to access database operation time

Time:11-20

Consult: VB.NET the form to write 1 the access database data, the corresponding date field how content in a record time automatically add 5 minutes, thank you, how to modify the following code, thank you,


Imports System. Data. The OleDb
Public Class Form1
Dim cn As OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As the DataSet
Private Sub Button1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles for. Click
Dim STR As String="Provider=Microsoft. Ace. The OLEDB. 12.0; Data \ \ aceess Source=C:\Users\Administrator\Desktop\vb.net database information table 2020 accdb; Persist Security Info=False "
Dim conn As OleDbConnection
Conn=New OleDbConnection (STR)
Conn. The Open ()
Dim strInsert As String
StrInsert="insert into information table (barcode, entry time) values ('" & amp; TextBox1. Text & amp; "', '" & amp; DateTimePicker1. Text & amp; "')
"Dim cmdInsert As OleDbCommand=New OleDbCommand (strInsert, conn.)
CmdInsert. ExecuteNonQuery ()
MsgBox (" success ")
StrInsert="select * from information table", "
Dim cmdView As New OleDbCommand (strInsert, conn.)
CmdView. ExecuteNonQuery ()
Dim da As New OleDbDataAdapter
Da=New OleDbDataAdapter (strInsert, conn.)
Dim ds As New DataSet
Da. The Fill (ds)
DataGridView1. The DataSource=ds. Tables (0)
End Sub
The End of the Class

CodePudding user response:

Add time why? Be read more by processing, direct write to write the time,

CodePudding user response:

1. Dateadd function, VS.Net and SQL support, grammar a little difference between
2. Type a datetime variable. AddMinutes (5)
  • Related