好的,这是我的代码:
Imports IBM.Data.DB2.iSeries
Module ConsoleData1
Sub Main()
'program identifier (to verify that you're using the right module)
Console.WriteLine("ConsoleData1.vb")
'create the connection object to the IBM i
Using cn As New iDB2Connection("DataSource=xxxxxxxxxxxxx")
Try
cn.Open()
Catch ex As iDB2Exception
Console.WriteLine("An error occurred on cn.Open()")
Exit Sub
End Try
'create a command object, initialize to valid SQL statement
Using cmd As New iDB2Command("select * from testlib.finishk", cn)
'create a command object, initialize to valid SQL statement
Console.Write("Enter the Color Code!==>")
Dim baldue = Console.ReadLine()
Dim sql As String = "Select * from testlib.finishk where FINCOD >=" & FINCOD
Using cmdx As New iDB2Command(sql, cn)
End Using
'create a data reader object, fill by executing the command
Try
Using dr As iDB2DataReader = cmd.ExecuteReader
'display data in a table
Console.Write("FINCOD" & vbTab)
Console.Write("FINDES" & vbTab)
While dr.Read()
Console.Write("{0}{1}", dr("FINCOD"), vbTab)
Console.Write("{0}{1}", dr("FINDES"), vbTab)
End While
End Using
Catch ex As iDB2Exception
Console.WriteLine("An error occurred on cmd.ExecuteReader()")
Exit Sub
End Try
End Using
End Using
Console.WriteLine("Press ENTER to end")
Console.ReadLine()
End Sub
Sub HandleError(ByVal errorOccurred As String, ByVal ex As iDB2Exception)
Console.WriteLine(errorOccurred)
Console.WriteLine("Source: {0}", ex.Source)
Console.WriteLine("SQLState: {0}", ex.SqlState)
Console.WriteLine("Message: {0}", ex.Message)
Console.WriteLine("MessageCode: {0}", ex.MessageCode)
Console.WriteLine("MessageDetails: {0}", ex.MessageDetails)
Console.ReadLine()
End Sub
Private Function Screen() As Object
Throw New NotImplementedException
End Function
End Module
现在,我将如何做到这一点,以便我可以将 cmd 窗口调整为更大并且仍然保持表结构的完整性?如果我调整 cmd 窗口的大小,它最终看起来就像有人只是将值随机放置到一个窗口中。
谢谢。