我正在使用 streamwriter 从 sql server 中提取数字来填充文本文件。但是如果它是 0,它会切断第一个数字。如果字符串只有 8 个字符长,如何自动将该数字添加到文本文件中?
Dim outputStream As StreamWriter = New StreamWriter(fileName)
'Get all values from the current item on the reader as long as Read() returns true...
Do While reader.Read
'make an array the length of the available fields
Dim values(reader.FieldCount - 1) As Object
'get all the field values
reader.GetValues(values)
'write the text version of each value to a comma seperated string
Dim line As String = String.Format("{0,-10}" & vbTab & "{1,-20}" & vbTab & "{2,-1}", values)
'write the csv line to the file
outputStream.WriteLine("091869" & vbTab & vbTab & vbTab & line)
Loop
所以现在如果数字是(011111111)它会返回(11111111)而不是(011111111)。我需要整数。