十二岁少年求助: 如何使vbs文件建立关联(就是打开一个文件后,接着打开另一个文件)

十二岁少年求助: 如何使vbs文件建立关联(就是打开一个文件后,接着打开另一个文件),第1张

开头那句Ws.……我就不写了

msgbox"点击确定打开下一个文件",,"系统消耐昌息"

ws.ruu"——————昌和扒" “填写你要执行的文件,如果还有以此内推

msgbox"所有文件棚运以打开,脚本自动退出"

vb代世则镇搜粗盯举码:

Shell "cmd.exe /c c:\test.vbs 99", vbHide

对应vbs文件中的代码:

msgbox wscript.arguments(0)

这样,VB中的99就会传递到vbs中的wscript.arguments(0)中

1. Open a new project in Visual Basic and add a Reference to the Microsoft ActiveX Data Objects library.

2. Place the following controls on the form:

Control Name Text/Caption

Button cmdCheckCheck

Button cmdSend Send

Text BoxtxtInput

Label lblInputInput:

3.

From the Tools menu, choose Options, Click the "Default Full Module

View" option, and then click OK. This allows you to view all of the code

for this project.

4. Paste the following code into your code window:

Option Explicit

Dim Cn As ADODB.Connection

Dim CPw1 As ADODB.Command

Dim CPw2 As ADODB.Command

Dim Rs As ADODB.Recordset

Dim Conn As String

Dim QSQL As String

Private Sub cmdCheck_Click()

CPw1(0) = Val(txtInput.Text)

Set Rs = CPw1.Execute

MsgBox "Item_Number = " &Rs(0) &". Depot_Number = " &Rs(1) &"."

Rs.Close

End Sub

Private Sub cmdSend_Click()

CPw2(0) = Val(txtInput.Text)

CPw2.Execute

MsgBox "Return value from stored procedure is " &CPw2(1) &"."

End Sub

Private Sub Form_Load()

'You will need to replace the "*" with the appropriate values.

Conn = "UID=*****PWD=****DRIVER={Microsoft ODBC for Oracle}" _

&"SERVER=*****"

Set Cn = New ADODB.Connection

With Cn

.ConnectionString = Conn

.CursorLocation = adUseClient

.Open

End With

QSQL = "Select Item_Number, Depot_Number From adooracle Where " _

&"item_number = "

Set CPw1 = New ADODB.Command

With CPw1

.ActiveConnection = Cn

.CommandText = QSQL

.CommandType = adCmdText

.Parameters.Append .CreateParameter(, adInteger, adParamInput)

End With

QSQL = "adoinsert"

Set CPw2 = New ADODB.Command

With CPw2

.ActiveConnection = Cn

.CommandText = QSQL

.CommandType = adCmdStoredProc

.Parameters.Append .CreateParameter(, adInteger, adParamInput)

.Parameters.Append .CreateParameter(, adDouble, adParamOutput)

End With

End Sub

Private Sub Form_Unload(Cancel As Integer)

Cn.Close

Set Cn = Nothing

Set CPw1 = Nothing

Set CPw2 = Nothing

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12265235.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存