Having trouble with a simple database command I keep getting the error invalid column name and I cant seem to figure it out. Please help me figure out some possible problems Thanks.

Dim ConnString As String
        ConnString = "Data Source=.\SQLEXPRESS;AttachDbFilename=
C:\inetpub\wwwroot\KiKoGraphics\App_Data\aspnetdb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
        Dim sqlConn As New SqlConnection(ConnString)
        Dim sqlCom As New SqlCommand()
        sqlCom.CommandText = "INSERT INTO ImageTable ('DatabaseImage') VALUES ('@Photo')"
        sqlCom.Connection = sqlConn
        sqlCom.Parameters.Add("@Photo", Data.SqlDbType.Image)
        sqlCom.Parameters("@Photo").Value = Content

Hi - Check the spelling on your SQL database, this is probably the issue. An invalid column name means the column simply doesn't exist as stated.

Also, try a test. What happens when you run the query:

Select DatabaseImage from ImageTable


P.S. If this helped, give me some points and marked as solved! :-)

Hey thanks for responding. The spelling is correct thats why I don't understand the error and I ran the query you suggested, I also ran an update query and in both cases the application did not crash (give me and error). What else could it be?

I would recommend not storing images into the database, but rather store the relative path of the image in the database. I think you will find this much better.

This question has already been answered. Start a new discussion instead.