Hi guys, still busy with the damn hotel project thingy for university.
I am now having a new issue, and the problem is as follows:
I have a roomtype table, where each roomtype has a specific price. The field in access is set as currency datatype.
Now, I have a query reading this value from the database to a variable of type Decimal. The code to do this is as follows:
Now, when running, I keep getting an OleDB exception stating that "Data type mismatch in criteria expression."
If anybody could please help with this, would be greatly appreciated
I am now having a new issue, and the problem is as follows:
I have a roomtype table, where each roomtype has a specific price. The field in access is set as currency datatype.
Now, I have a query reading this value from the database to a variable of type Decimal. The code to do this is as follows:
Code:
Function GetRoomPrice(ByVal intRoomType As Integer) As Decimal
Dim m_Conn As New OleDb.OleDbConnection
Dim dbCMD As New OleDb.OleDbCommand
m_Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\GHMRS.mdb"
m_Conn.Open()
dbCMD.CommandText = "SELECT RatePerPerson FROM RoomType WHERE RoomTypeID = '" & intRoomType.ToString & "'"
dbCMD.Connection = m_Conn
GetRoomPrice = CDec(dbCMD.ExecuteScalar)
m_Conn.Close()
End Function
Now, when running, I keep getting an OleDB exception stating that "Data type mismatch in criteria expression."
If anybody could please help with this, would be greatly appreciated
Last edited: