我试图将声明为字符串的变量输入到我的访问数据库中。单击按钮时,#34; Ticket Status"未输入访问数据库。
Dim str As String
str = "update [tblUsers] set [Campus] = '" & cmboxCampus.SelectedItem & "' , [ProblemType] = '" & cmboxProblemType.SelectedItem & "', [IfOther] = '" & txtIfOther.Text & "', [Status] = '" & TicketStatus & "', [ProblemDescription] = '" & txtDescription.Text & "' Where [Username] = '" & txtUsername.Text & "'"
Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)
TicketStatus = "Ticket being Assigned"
If txtIfOther.ReadOnly = True And txtIfOther.Text <> "" Then
MsgBox("When selecting 'other' please specify")
End If
If txtDescription.Text = "" Or cmboxCampus.SelectedItem = "" Or cmboxProblemType.SelectedItem = "" Then
MsgBox("Please fill out all fields.", MsgBoxStyle.Information)
Else
Try
cmd.ExecuteNonQuery()
cmd.dispose()
myConnection.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox("Your ticket has been successfully submitted.", MsgBoxStyle.Information)
End If
End Sub