Question : Multi-part identifier could not be bound

Hi all,

I'm getting a multi-part identifier on this code, but I'm flumoxed as to why. The control is dynamic from the gridview and the new filename is correct as I have tested the value of newFileName.

TIA.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Dim con As New SqlConnection(ConnectionStrings("dev").ConnectionString)
 
        Dim row As GridViewRow = gvwCurrentMaterial.Rows(e.RowIndex)
        Dim newFilename As String = CType(row.Cells(2).Controls(0), TextBox).Text
 
        Dim cmd As New SqlCommand("Update dbo.trn_fileSystemCourseMaterials Set originalFilename =" & newFilename & _
            " Where materialsID =" & Convert.ToInt32(Request.Cookies("courseid").Value), con)
 
        cmd.CommandType = CommandType.Text
        con.Open()
        cmd.ExecuteNonQuery()
        con.Close()
        populateCurrentCourseMaterial(Convert.ToInt32(Request.Cookies("courseid").Value))
Open in New Window Select All

Answer : Multi-part identifier could not be bound

please try this:
1:
2:
  Dim cmd As New SqlCommand("Update dbo.trn_fileSystemCourseMaterials Set originalFilename = '" & newFilename & _
            "' Where materialsID =" & Convert.ToInt32(Request.Cookies("courseid").Value), con)
Open in New Window Select All
Random Solutions  
 
programming4us programming4us