I am trying to do an insert into a database from an ASP.NET page using VB.NET code. The problem is this code is throwing an exception: The name 'xls'
is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

If I try to put an .exe file into the database replace the 'xls' with 'exe'.

Here is the code:
VB Code:
  1. Option Explicit On
  2. Imports System.Data.SqlClient
  3. Public Class filestoreadd
  4.     Inherits System.Web.UI.Page
  5.  
  6. #Region " Web Form Designer Generated Code "
  7.  
  8.     'This call is required by the Web Form Designer.
  9.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  10.  
  11.     End Sub
  12.     Protected WithEvents cmdUpload As System.Web.UI.WebControls.Button
  13.     Protected WithEvents fileUpload As System.Web.UI.HtmlControls.HtmlInputFile
  14.     Protected WithEvents Label1 As System.Web.UI.WebControls.Label
  15.     Protected WithEvents Label2 As System.Web.UI.WebControls.Label
  16.     Protected WithEvents Label3 As System.Web.UI.WebControls.Label
  17.     Protected WithEvents txtDescript As System.Web.UI.WebControls.TextBox
  18.  
  19.     'NOTE: The following placeholder declaration is required by the Web Form Designer.
  20.     'Do not delete or move it.
  21.     Private designerPlaceholderDeclaration As System.Object
  22.  
  23.     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
  24.         'CODEGEN: This method call is required by the Web Form Designer
  25.         'Do not modify it using the code editor.
  26.         InitializeComponent()
  27.     End Sub
  28.  
  29. #End Region
  30.  
  31.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  32.         'Put user code to initialize the page here
  33.     End Sub
  34.     Public Function GetByteArrayFromFileField( _
  35.       ByVal FileField As System.Web.UI.HtmlControls.HtmlInputFile) _
  36.       As Byte()
  37.         ' Returns a byte array from the passed
  38.         ' file field controls file
  39.         Dim intFileLength As Integer, bytData() As Byte
  40.         Dim objStream As System.IO.Stream
  41.  
  42.         intFileLength = FileField.PostedFile.ContentLength
  43.         ReDim bytData(intFileLength)
  44.         objStream = FileField.PostedFile.InputStream
  45.         objStream.Read(bytData, 0, intFileLength)
  46.         Return bytData
  47.  
  48.     End Function
  49.  
  50.     Public Function FileFieldType(ByVal FileField As _
  51.   System.Web.UI.HtmlControls.HtmlInputFile) As String
  52.         ' Returns the type of the posted file
  53.         If Not FileField.PostedFile Is Nothing Then _
  54.           Return FileField.PostedFile.ContentType
  55.     End Function
  56.  
  57.     Public Function FileFieldLength(ByVal FileField As _
  58.       System.Web.UI.HtmlControls.HtmlInputFile) As Integer
  59.         ' Returns the length of the posted file
  60.         If Not FileField.PostedFile Is Nothing Then _
  61.           Return FileField.PostedFile.ContentLength
  62.     End Function
  63.  
  64.     Public Function FileFieldFilename(ByVal FileField As _
  65.   System.Web.UI.HtmlControls.HtmlInputFile) As String
  66.         ' Returns the core filename of the posted file
  67.         If Not FileField.PostedFile Is Nothing Then _
  68.           Return Replace(FileField.PostedFile.FileName, _
  69.           StrReverse(Mid(StrReverse(FileField.PostedFile.FileName), _
  70.           InStr(1, StrReverse(FileField.PostedFile.FileName), "\"))), "")
  71.     End Function
  72.  
  73.  
  74.     Private Sub cmdUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpload.Click
  75.         Dim filelength As Integer
  76.         Dim filedata(filelength) As Byte
  77.         Dim filetype As String
  78.         Dim filename As String
  79.         filelength = FileFieldLength(fileUpload)
  80.         filedata = GetByteArrayFromFileField(fileUpload)
  81.         filetype = FileFieldType(fileUpload)
  82.         filename = FileFieldFilename(fileUpload)
  83.         Dim addQuery As String
  84.         Dim filedescription As String
  85.         Dim filedate As String
  86.         Dim uploadperson As String
  87.         filedescription = txtDescript.Text
  88.         filedate = Now.Date.ToString
  89.         If Session("Usernme") = Nothing Then
  90.             uploadperson = "taylorce"
  91.         Else
  92.             uploadperson = Session("Usernme")
  93.         End If
  94.         Dim sqlconn As SqlConnection = New SqlConnection
  95.         Dim strConn As String
  96.         strConn = "Server=SERVER;Database=test;User ID=testuser;Password=Password1"
  97.         sqlconn.ConnectionString = strConn
  98.         sqlconn.Open()
  99.         addQuery = "INSERT INTO docstore(docname, doclength, doctype, docdescription, uploadby, uploaddate, actualdoc) VALUES_
  100.  (" & filename & ", '" & filelength & "', " & filetype & ", '" & txtDescript.Text & "', _
  101. " & uploadperson & ", " & filedate & ", @data)"
  102.         Dim aCommand As New SqlCommand(addQuery, sqlconn)
  103.         aCommand.Parameters.Add("@data", SqlDbType.Image, filedata.Length, "actualdoc")
  104.         aCommand.ExecuteNonQuery()
  105.         sqlconn.Close()
  106.         Page.RegisterStartupScript("script2", "<script language=javascript>alert('Your file has been added.');</script>")
  107.     End Sub
  108. End Class

Thanks in advance,
Polariss