Sub procedure3
Dim sPro
Dim sDsn
Dim sSer
Dim sCon
Dim sSql
Dim conn
Dim oRs
Dim oCom
Dim myMinute, mySecond
Dim TintData TfloatData, TboolData TstringData, Tdate, Ttime
TintData=https://bbs.csdn.net/topics/HMIRuntime.tags (" TintData "). The Read
TfloatData=https://bbs.csdn.net/topics/HMIRuntime.tags (" TfloatData "). The Read
TboolData=https://bbs.csdn.net/topics/HMIRuntime.tags (" TboolData "). The Read
TstringData=https://bbs.csdn.net/topics/HMIRuntime.tags (" TstringData "). The Read
Tdate=HMIRuntime. Tags (" Tdate "). The Read
Ttime=HMIRuntime. Tags (" Ttime "). The Read
MyMinute=HMIRuntime. Tags (" Tminute1 "). The Read
MySecond=HMIRuntime. Tags (" Tsecond1 "). The Read
If ((myMinute=0 And mySecond=0) Or (myMinute=10 And mySecond=0) Or (myMinute=20 And mySecond=0) Or (myMinute=30 And mySecond=0) Or (myMinute=40 And mySecond=0) Or (myMinute=50 And mySecond=0)) Then
SCon="Provider=SQLOLEDB. 1; Integrated Security=SSPI; Persist Security Info=False; Initial Catalog=test; Data Source=GUANLV02 \ WINCC "
sSql="insert into Table6 (Tdate, Ttime, TintData TfloatData, TboolData, TstringData) values ('" & amp; Tdate & amp; "', '" & amp; Ttime & amp; "'," & amp; TintData & amp; ", "& amp; TfloatData & amp; ", "& amp; TboolData & amp; ", '" & amp; TstringData & amp; "')"
Set the conn=CreateObject (" adodb. Connection ")
Conn. The connectionstring=sCon
Conn. Open
The Set oRs=CreateObject (" adodb. You ")
Mand Set oCom=CreateObject (" adodb.com ")
OCom.com mandType=1
The Set oCom. ActiveConnection=conn
OCom.com mandText sSql=
The Set of oRs=oCom. Execute
The Set oCom=Nothing
Conn. Close
The Set of oRs=Nothing
Set the conn=Nothing
End the If
End Sub
Perform database after the results are as follows:
Consult:
Why is this? Is my SQL insert statement is not complete? Or what other reason?
My request is to insert time is according to the descending order, how to do?
Thank you for your attention!
CodePudding user response:
Insertion order is not important, what do you want to order, query time and the order by is ok,CodePudding user response:
Select * from table name for the order by the field name descThis query is displayed when descending order according to the specified field
CodePudding user response: