I have a form with three textboxes. (users, time, cost). According to what is written on the users box the winform makes some calculations and fills in the cost box. The user inserts the time and multiplies that with an integer pulled from the database according what name was in the users box. The sum is written on the cost box as I already said. When I run the program it throws an exception saying that no data could be found in the row/column. I have triple check my code and could not find anything. Here is code initiated with the text changed event on the time box.
I am using VB 2008 expess and Access 2007 for database
VB.NET:
Dim hours As Integer
Dim cost As Integer
Dim rate As Integer
hours = Me.TextBox2.Text
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=...........................................)
conn.Open()
Dim sql As String
Dim reader As OleDbDataReader
sql = "SELECT * FROM Users WHERE UserName = '" & Me.techniciansTextBox.Text & "'"
Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
reader = cmd.ExecuteReader
rate = reader("HourRate").ToString
cost = hours * rate
Me.TextBox5.Text = cost
I am using VB 2008 expess and Access 2007 for database