I have the following code inside a function that handles a form submit.
The code does not produce any errors, but it doesn't work either. The debug_label that I set as the bottom of the function does not get set either.
Also, I use connectionString1 for populating a gridview so I know the connection string is good.
Can anyone point me in the right direction?
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim sqlstr As String, ans As Boolean
Dim strConnection As String = ConfigurationManager.ConnectionStrings("ConnectionString1").ConnectionString
cn = New OleDbConnection()
cn.ConnectionString = strConnection
sqlstr = "INSERT INTO PRACTISE(ID,rating,comment,user_name,product_name) VALUES('" & _
Convert.ToInt32(comment_id) & "','" & _
Trim(rating) & "','" & _
Trim(comment) & "','" & _
Trim(username) & "','" & _
Trim(product) & "')"
cmd = New OleDbCommand(sqlstr, cn)
ans = cmd.ExecuteNonQuery()
If (ans = True) Then
cmd = Nothing
debug_label.Text() = strConnection