我想讓自動編號,並得到了下面的錯誤 請幫我解決它。需要幫助:從字符串「RS201504170001」轉換爲類型'雙'無效
下面是我的代碼:
Sub noresep()
Call Koneksi()
Dim nors As String = "Select * from tb_resep where no_resep in (Select max(no_resep) from tb_resep)"
cmd = New MySqlCommand(nors, db)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
txt_noresep.Text = "RS" + Format(Now, "yyyyMMdd") + "0001"
Else
If Microsoft.VisualBasic.Mid(CStr(dr.Item("no_resep")), 3, 8) <> Format(Now, "yyyyMMdd") Then
txt_noresep.Text = "RS" + Format(Now, "yyyyMMdd") + "0001"
Else
txt_noresep.Text = CDbl(dr.Item("no_resep")) + 1 'Error in this line
End If
我得到錯誤:從字符串「RS201504170001」轉換爲鍵入'雙'無效。 –
「自動編號」不提供關於您的代碼試圖執行的任何信息。在不知道代碼應該達到什麼目的的情況下,任何人都無法就修復提出建議。 – Unihedron