I am writing a guest book for a web page that I am developing at the moment. The guest book is kept in an access database.

I can get the data out alright and display it, however the problem occurs when the user goes to add a comment.

Everything works fine. The user puts all the info in and then clicks on the submit button. It seems that it works. But when the page refreshes the data is not there.

I think there must be something wrong with the add function.

Could some one please help me out as I am at the end of my witts.

The code is below. Cheers,

Public Function Add(ByVal Author As String, ByVal Email As String, _
ByVal Homepage As String, ByVal State As String, ByVal Comment As String) As Boolean
Dim sql As String = "INSERT INTO Comments (Author, Email, Homepage, State, Comment) "
sql += "VALUES (@Author, @Email, @Homepage, @State, @Comment)"
' create a new OleDbCommand and set its params
Dim myCmd As OleDbCommand = New OleDbCommand(sql, _Connection)
myCmd.Parameters.Add(New OleDbParameter("@Author", OleDbType.VarChar, 50))
myCmd.Parameters("@Author").Value = Author.Trim()
myCmd.Parameters.Add(New OleDbParameter("@Email", OleDbType.VarChar, 50))
myCmd.Parameters("@Email").Value = Email.Trim()
myCmd.Parameters.Add(New OleDbParameter("@Homepage", OleDbType.VarChar, 100))
myCmd.Parameters("@Homepage").Value = Homepage.Trim()
myCmd.Parameters.Add(New OleDbParameter("@State", OleDbType.VarChar, 50))
myCmd.Parameters("@State").Value = State.Trim()
myCmd.Parameters.Add(New OleDbParameter("@Comment", OleDbType.VarChar))
myCmd.Parameters("@Comment").Value = EncodeHTMLText(Comment.Trim())
Add = True
myCmd.Connection.Open()
Try
myCmd.ExecuteNonQuery()
Catch e As OleDbException
Add = False
Finally
myCmd.Connection.Close()
End Try
End Function