R
Rohan Danushka
Guest
Hi,
Please help me with this.
System.Data.SqlClient.SqlException: 'The variable name '@MBid' has already been declared. Variable names must be unique within a query batch or stored procedure.'
Public Function SYSSerial() As Boolean
If K9ConfigConn.State = ConnectionState.Closed Then K9ConfigConn.Open()
DR.Close()
Dim PCMBid As String = K9Core.GetSysSerialNo
Dim PCCPUid As String = K9Core.GetCPUID
CMD.Connection = K9ConfigConn
CMD.CommandType = CommandType.Text
With CMD
.Parameters.AddWithValue("@MBid", PCMBid)
.Parameters.AddWithValue("@CPUid", PCCPUid)
End With
CMD.CommandText = "SELECT * FROM k9info WHERE mbid=@MBid AND cpuid=@CPUid"
DR = CMD.ExecuteReader()
If DR.Read = True Then
Return True
wasSuccessful = True
ElseIf DR.Read = False Then
Return False
wasSuccessful = False
End If
CMD.Dispose()
K9ConfigConn.Close()
If wasSuccessful = True Then Return True Else Return False
End Function
![1464806.png 1464806.png](https://www.computerhelp.forum/data/attachments/56/56476-4964d464b0a75671be954f88fd7139df.jpg?hash=SWTUZLCnVn)
Thank you....
RohanD
Continue reading...
Please help me with this.
System.Data.SqlClient.SqlException: 'The variable name '@MBid' has already been declared. Variable names must be unique within a query batch or stored procedure.'
Public Function SYSSerial() As Boolean
If K9ConfigConn.State = ConnectionState.Closed Then K9ConfigConn.Open()
DR.Close()
Dim PCMBid As String = K9Core.GetSysSerialNo
Dim PCCPUid As String = K9Core.GetCPUID
CMD.Connection = K9ConfigConn
CMD.CommandType = CommandType.Text
With CMD
.Parameters.AddWithValue("@MBid", PCMBid)
.Parameters.AddWithValue("@CPUid", PCCPUid)
End With
CMD.CommandText = "SELECT * FROM k9info WHERE mbid=@MBid AND cpuid=@CPUid"
DR = CMD.ExecuteReader()
If DR.Read = True Then
Return True
wasSuccessful = True
ElseIf DR.Read = False Then
Return False
wasSuccessful = False
End If
CMD.Dispose()
K9ConfigConn.Close()
If wasSuccessful = True Then Return True Else Return False
End Function
![1464806.png 1464806.png](https://www.computerhelp.forum/data/attachments/56/56476-4964d464b0a75671be954f88fd7139df.jpg?hash=SWTUZLCnVn)
Thank you....
RohanD
Continue reading...