|
A function is defined Public Function RunCard_Query(ByVal strtype As String, ByVal strdate As String, ByVal strclass As String) As DataSet
Dim data As New DataSet()
dsCommand.SelectCommand = New SqlCommand("SELECT MAX(CAST(SUBSTRING(RUNCARD,2,9) AS INTEGER)) AS NUM FROM RUNCARD WHERE TYPE ='" + strtype + "'AND CLASSNAME ='" + strclass + "'AND RUNCARD LIKE'" + strdate + "'+'%'", con)
'dsCommand.SelectCommand = New SqlCommand("SELECT COUNT(*) AS NUM FROM RUNCARD WHERE TYPE ='" + strtype + "'AND CLASSNAME ='" + strclass + "'AND RUNCARD LIKE'" + strdate + "'+ ' %'", con)
dsCommand.Fill(data)
RunCard_Query = data
End Function
Reference ds = mySqlData.RunCard_Query("Wafer_Lot", strdate, "PRO")
Dim i As Integer
Dim j As Integer
i = ds.Tables(0).Rows(0)("num")
j = i + 1
...
As a result, it says that the coercive conversion from type "DBNull" to type "Integer" is invalid. Please expert advice, urgent!!! |
|