I am trying to store three values that I take from my web form and place them into a database that I have.
At the minute when I try this, the (UserID, Title, Description) line doesn't accept and the Title and Description are underlined in blue. I have tried putting in & instead of the comma but then it takes it all as one long string.
I have tried so many ways to try and get it to place the right data into the right space in my database and I cannot seem to work out what I'm doing wrong.
Any help would be greatly appreciated.
Many thanks
At the minute when I try this, the (UserID, Title, Description) line doesn't accept and the Title and Description are underlined in blue. I have tried putting in & instead of the comma but then it takes it all as one long string.
I have tried so many ways to try and get it to place the right data into the right space in my database and I cannot seem to work out what I'm doing wrong.
Any help would be greatly appreciated.
Many thanks
Code:
Function SubmitRequest() As Boolean Dim myConn As OleDbConnection Dim myCmd As OleDbCommand Dim myDr As OleDbDataReader Dim RequestTable As New DataTable Dim UserID As Integer = CType(Session.Item("UserID"), String) Dim Title As String = txtRequestTitle.Text Dim Description As String = txtProblemDescription.Text myConn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\Helpdesk\Test\Database.accdb;Persist Security Info=True") myConn.Open() 'myCmd = New OleDbCommand("select ID, Title, ProblemDescription from Request where StaffID=" & UserID & "", myConn) 'myCmd = New OleDbCommand("INSERT StaffID, Title, ProblemDescription) VALUES ( & UserID & Title & Description" & "", myConn) 'myCmd = New OleDbCommand("INSERT Request StaffID, Title, ProblemDescription) VALUES " & '"UserID, Title, Description"'"), myConn) 'myCmd = New OleDbCommand("INSERT INTO Request StaffID, Title, ProblemDescription) VALUES (@UserID, @Title, @Description)", myConn) myCmd = New OleDbCommand("INSERT INTO Request StaffID, Title, ProblemDescription) VALUES "(UserID, Title, Description), myConn) 'myDr = myCmd.ExecuteReader 'RequestTable.Load(myDr) Return True End Function
Comment