Write the VB program into a VBScript mode in the VBS file

zhaozj2021-02-17  55

There may be a lot of friends to meet such a question: I want to write some code that will change as a VBS script. When you want to change the program, just change the script.

The VB is called as follows:

Set GenVb = CreateObject ( "GenVB.GenVbParse") Set ado = CreateObject ( "ADODB.Connection") Set rs = CreateObject ( "adodb.recordset") ado.ConnectionString = m_Ado.ConnectionStringado.Open GenVb.AddObject m_Grid, "m_Grid" Genvb.addObject Ado, "ADO" genvb.addobject RS, "RS" RET = Genvb.Runscript ("c: /vbtest/test.vbs") if Ret = -1 Then MsgBox "Error" End IF

Test.vbs scripts are as follows:

DIM SQLDIM IM_GRID.COLS = 6m_Grid.Rows = 1

m_grid.fixedcols = 0m_Grid.TextMatrix (0, 0) = "Name" m_grid.textmatrix (0, 1) = "Language" m_grid.textMatrix (0, 2) = "Mathematics" M_Grid.TextMatrix (0, 3) = " English "M_Grid.TextMatrix (0, 4) =" Total "M_Grid.TextMatrix (0, 5) =" Average "SQL =" SELECT * from CJ, Student Where Cj.id = Student.ID "RS.Open SQL, ADO , 1, 3Do while not rEF m_grid.additem (") i = m_grid.Rows i = i - 1 m_Grid.TextMatrix (i, 0) = rs (" xm ") m_grid.textMatrix (i, 1) = RS ("yw") m_grid.textMatrix (i, 2) = rs ("sx") m_grid.textMatrix (i, 3) = rs ("yy") m_grid.textMatrix (i, 4) = (RS ("yw ") RS (" SX ") RS (" YY ") / 3 m_Grid.TextMatrix (I, 5) = RS (" YW ") RS (" SX ") RS (" YY ") RS. MoveNextLooprs.close

If you want to see, please contact: zcg2000@netese.com

转载请注明原文地址:https://www.9cbs.com/read-28752.html

New Post(0)