I've been struggling to figure this one out, and keep running into the same issue. I have an Access database that has linked Excel Files. The title of the excel file is Store # and the pound symbol is where I'm running into issues.
New OleDbCommand("SELECT * FROM LSM WHERE Store # = @Store", myConnection)
lstscmd.Parameters.AddWithValue("@Store", CInt(gateDBSearch))
If I remove the # symbol, and remove it in my code it works (The richtexbox shows only the result for the record searched), unfortunately this isn't an option in the final version. If I leave the # symbol in the file, but remove it from the code, the richtextbox fills with all of the results. If I leave the # symbol on both the code and file I get a Syntax error in date in query expression 'Store # = @Store' exception. Any help on this would be great.
Dim lstscmd As OleDbCommand = New OleDbCommand("SELECT * FROM LSM WHERE Store # = @Store", myConnection)
lstscmd.Parameters.AddWithValue("@Store", CInt(gateDBSearch))
dr = lstscmd.ExecuteReader
While dr.Read()
txtRichInfo.AppendText(dr("Gate Tech").ToString + Environment.NewLine)
lblAccessSysChange.Text = dr("Access System").ToString
End While
myConnection.Close()
lblAccessSysChange.Visible = True