Dear all
I was using vb6, now i shifted to vb.net, but i couldn't able to convert this below code, please help, thanks in advance
Function GenerateCode(mTblName As String, mFldName As String, mConn As Object, mscode As String, mLength As String) As String
Dim mRs As ADODB.Recordset
Dim mSqlst As String
Dim mCode
Dim mmCode As String
Dim i As Integer
mSqlst = "select " & mFldName & " from " & mTblName & _
" where " & mFldName & " like '" & mscode & "%'" & _
" order by cust_code"
'MsgBox mSqlst
Set mRs = New ADODB.Recordset
mRs.Open mSqlst, mConn, adOpenStatic, adLockOptimistic, adCmdText
If Not mRs.EOF Then
mRs.MoveLast
mCode = Mid(mRs(0), 4) + 1
'mCode = mRs(0)
mRs.Close
Set mRs = Nothing
Else
mCode = 1
End If
'mmCode = ""
For i = 1 To mLength - Len(mCode)
mmCode = mmCode & "0"
Next
mmCode = mscode & mmCode & mCode
GenerateCode = mmCode
'canno = GenerateCode("ai_advcan", "canno", CONN, stationcode, 5)
End Function
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).