如何从ComboBox和TextBox的值获取到参数行?

时间:2019-06-14 11:32:37

标签: vb.net

我想用VB.NET中的外部程序解压缩特定文件,但是我不知道该怎么做。 这是我的尝试。

public class dbtest {

    public static Session session = null;

    public ArrayList < String > ColValue() throws IOException {
        // TODO Auto-generated method stub

        FileReader reader = new FileReader("Configuration\\Config.properties");

        Properties p = new Properties();
        p.load(reader);

        String serverIp = p.getProperty("ServerIp");
        String keyspace = p.getProperty("ServerPwd");

        Cluster cluster = Cluster.builder().addContactPoints(serverIp).withCredentials("user", "password").build();
        session = cluster.connect(server);
        String query = null;
        String cqlStatement = "select * from table_name";

        ArrayList < String > casVal1 = new ArrayList < >();
        for (Row row: session.execute(cqlStatement)) {
            if (!casVal1.contains(query)) {
                casVal1.add(query);
            }
        }
        System.out.println(casVal1.size());
        System.out.println(casVal1);

        return (casVal1);
    }
}

1 个答案:

答案 0 :(得分:0)

他们使用提供的DLL代替了7z.exe。

Public Class ArchivationHandling
Private Declare Function SevenZip Lib "7-zip32.dll" (ByVal hwnd As Integer, ByVal strCmdLine As String, ByVal strOutput As String, ByVal dwSize As Integer) As Long
Private bJobCompleted As Boolean = False
Private Const ZIP_EXTENSION As String = ".zip"
Private Const SEVEN_ZIP_PAR As String = vbNullString
Private Function Decompress(ByVal strZipPath As String, ByVal strOutPut As String) As Boolean
    Dim strZipComm As String = "x -o" & strOutPut & " " & strZipPath & ZIP_EXTENSION & " -hide"
    Try
        SevenZip(0, strZipComm, SEVEN_ZIP_PAR, 0)
        bJobCompleted = True
    Catch ex As Exception
        Logger.WriteLogEntry(4, "Decompression failed for file: " & strZipPath & " " & ex.Message.ToString)
    End Try
    Return bJobCompleted
End Function
Public ReadOnly Property Decompression(ByVal strZipFilePath As String, ByVal strOutput As String) As Boolean
    Get
        Return Decompress(strZipFilePath, strOutput)
    End Get
End Property

结束班级

这是我在一个应用程序中使用的示例。 您只需提供输入文件和输出即可。