Hi all,
How to use AddWithValue for updating statement? For insert new data, it's ok. But for updating, it not updating the arrImg and arrLogo where it become null on mysql. Below is my code for updating. please see and guide me.
strSQL = "UPDATE malldir.tbldirectory SET dirno=@dirno,dirname=@dirname,dirdetails=@dirdetails,category=@category,level=@level,lotno=@lotno,website=@website,phoneno=@phoneno,dirinitial=@dirinitial,dir_image=@dirimage,dir_logo=@dirlogo WHERE dirname='" & strcTmpDir.strShopOldName & "';"
mysqlconn = New MySqlClient.MySqlConnection(MyConnectionString)
mysqlconn.Open()
With mysqlcmd
.CommandText = strSQL
.Connection = mysqlconn
.Parameters.AddWithValue("@dirno", strcTmpDir.strShopNo)
.Parameters.AddWithValue("@dirname", strcTmpDir.strShopName)
.Parameters.AddWithValue("@dirdetails", strcTmpDir.strShopDetails)
.Parameters.AddWithValue("@category", strcTmpDir.strCategory)
.Parameters.AddWithValue("@level", strcTmpDir.strFloor)
.Parameters.AddWithValue("@lotno", strcTmpDir.strLotNo)
.Parameters.AddWithValue("@website", strcTmpDir.strWebsite)
.Parameters.AddWithValue("@phoneno", strcTmpDir.strPhoneNo)
.Parameters.AddWithValue("@dirinitial", strcTmpDir.strInit)
.Parameters.AddWithValue("@dirimage", strcTmpDir.arrImg)
.Parameters.AddWithValue("@dirlogo", strcTmpDir.arrLogo)
intRec = .ExecuteNonQuery()
End With
Is my sql statement is good?any suggestion?