Tornado API Library - V12.30.08

z.ASPdbExecuteCmdMethod

Execute the dbSilentCmdText in a "stand alone" mode and returns the total records affected in executing multiple SQLs (-1 = error).

Product Version

Gold
[VisualBasic]
PublicFunctionASPdbExecuteCmd()AsLong
[C#]
publiclongASPdbExecuteCmd();

Return Value

int irec = Mydb.ASPdbExecuteCmd

Remarks

Example

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim Ename As String = "Hello"
  Dim Eemail As String = "World"
  Dim userdb As String = Server.MapPath("/MySite/Mydb.mdb") 
  Dim x As New Tornado.z
    x.dbQP = "u=1|Q=Eval|D=" & userdb
    Dim pur As String = CStr(Now())
    Dim maint As String = CStr(Now())
    Dim values As String = "('" & Ename & "'," & "'" & Eemail & "'," & "#" & pur & "#," & "#" & maint & "#)"
    x.dbSilentCmdText = "com=INSERT INTO Eval (Ename,Eemail,purchase,maint) VALUES " & values
    If x.ASPdbExecuteCmd() > 0 Then
        Response.Write("Done")
        Else
        Response.Write("failed")
        End If
End Sub
</script>
MySQLCmd.txt file content -
INSERT INTO T1 (F_DATE,F_TIME,F_CHARACTER,F_INTEGER,F_TIMESTAMP) VALUES ('2007-11-20','9:11:31','Kwong123',456,'2007-11-20 21:30:29');
INSERT INTO T1 (F_DATE,F_TIME,F_CHARACTER,F_INTEGER,F_TIMESTAMP) VALUES ('2007-12-20','9:11:31','Kwong123',456,'2007-11-20 21:30:29');
INSERT INTO T1 (F_DATE,F_TIME,F_CHARACTER,F_INTEGER,F_TIMESTAMP) VALUES ('2007-09-20','9:11:31','Kwong123',456,'2007-11-20 21:30:29');
Y.dbSilentCmdText="command=UPDATE Daily_Cane SET Car_no=9999,Quota_no=99, Type=99 WHERE Billno=20001 | command=UPDATE Daily_Cane SET Car_no=8888,Quota_no=88, Type=88 WHERE Billno=20002"

x.dbSilentCmdText = "com=INSERT INTO T1 (F_DATE,F_TIME,F_CHARACTER,F_INTEGER,F_TIMESTAMP) VALUES ('2007-11-20','9:11:31','Kwong123',456,'2007-11-20 21:30:29')"

Y.ASPdbExecuteCmd

See Also

z Class | Tornado Namespace | dbSilentCmdText