MySQL Does not UPDATE second column.

SQL = "UPDATE sampletable SET column1 = 'C1sample1'" & _
                ",column2 ='C2sample1'" & _
                "WHERE column2 = 'C2sample1'"

Recommended Answers

All 4 Replies

Are u developin a web app or a windows app ? which lang are u using for ur development? can u be a lil specific. Tx

Set column2 ='C2sample1'
WHERE column2 = 'C2sample1'"

If Column2 already equals C2Sample1, then your replacing the column value with the same exact value that your searching for.

SQL = "UPDATE sampletable 
                SET column1 = 'C1sample1',
                column2 ='NewValue' 
                WHERE column2 = 'OldValue'"
Set column2 ='C2sample1'
WHERE column2 = 'C2sample1'"

If Column2 already equals C2Sample1, then your replacing the column value with the same exact value that your searching for.

Thank you Tom, I noticed it now.

This is my actual code(bone structure)

Public Sub Update(ByVal Column1 As String, ByVal Column2 As String)
............
SQLString = "Set column2 ='" & Column2 &  "'
WHERE column2 = '" & Column2 &  "'"
............
............
End Sub
SQL = "UPDATE sampletable 
                SET column1 = 'C1sample1',
                column2 ='NewValue' 
                WHERE column2 = 'OldValue'"

Thank you adatapost for your reply, I clearly understand it now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.