Hello..
i have a table named Tuition with fields:
TuitionNum,TotalFee,Fine,levelNum,SchoolYear,DateCreated,Removed,DateLastModified,UserID
I inserted record successfully but when i'm trying to display TotalFee using this code,
myConnString = "server=localhost;" _
& "user id=root;" _
& "password=fiancee;" _
& "database=anneclaire"
SQL = "SELECT TotalFee FROM Tuition WHERE levelNum='" & TextBox1.Text & "' AND SchoolYear='" & TextBox2.Text & "'"
myConnection.ConnectionString = myConnString
Try
myConnection.Open()
myCommand.Connection = myConnection
myCommand.CommandText = SQL
TotalFee = myCommand.ExecuteScalar
Label1.Text = TotalFee
Catch myerror As MySqlException
MessageBox.Show("Error connecting to the database: " & myerror.Message)
Finally
If myConnection.State <> ConnectionState.Closed Then myConnection.Close()
End Try
this gives me a value of 0 in TotalFee whatever levelNum and SchoolYear is given.
What might be the problem?
Please give some advice and code for me to analyze it. Thank u so much for help.
Archelle,