P
Peter
I will excute the code below to get MethodName array. These codes are
edited under VS2003. Now I want to upgrade it to VS2005,but VS2005 gives me
a varning message: The varible "sSourceMethodName" may throw a Null
reference exception because it passes using "Byref" before being assigned.
Although it's just a warning I still want to let ift fit the VS2005's
recommended mode.
Any suggestions will be appreciated,
Peter
'------------------------------------------
Dim sSourceSampleName() As String
Dim Count as integer
Count = GetMethodName( sSourceMethodName)
Public Function GetMethodName( ByRef sMethodName() As String) As Integer
Dim odr As OleDbDataReader
Dim i, j As Integer
j = GetMethodCount() 'Defined in other places
ReDim sMethodName(j - 1)
Dim oCmd As New OleDbCommand
'Connection ConnImport has been opened
With oCmd
.Connection = ConnImport
.CommandType = CommandType.StoredProcedure
.CommandText = "udpGetMethodName"
End With
odr = oCmd.ExecuteReader
Do While odr.Read()
sMethodName(i) = odr(0)
i += 1
Loop
If Not odr.IsClosed Then odr.Close()
Return j
End Function
'--------------------------------------------------------------
edited under VS2003. Now I want to upgrade it to VS2005,but VS2005 gives me
a varning message: The varible "sSourceMethodName" may throw a Null
reference exception because it passes using "Byref" before being assigned.
Although it's just a warning I still want to let ift fit the VS2005's
recommended mode.
Any suggestions will be appreciated,
Peter
'------------------------------------------
Dim sSourceSampleName() As String
Dim Count as integer
Count = GetMethodName( sSourceMethodName)
Public Function GetMethodName( ByRef sMethodName() As String) As Integer
Dim odr As OleDbDataReader
Dim i, j As Integer
j = GetMethodCount() 'Defined in other places
ReDim sMethodName(j - 1)
Dim oCmd As New OleDbCommand
'Connection ConnImport has been opened
With oCmd
.Connection = ConnImport
.CommandType = CommandType.StoredProcedure
.CommandText = "udpGetMethodName"
End With
odr = oCmd.ExecuteReader
Do While odr.Read()
sMethodName(i) = odr(0)
i += 1
Loop
If Not odr.IsClosed Then odr.Close()
Return j
End Function
'--------------------------------------------------------------