Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
saidev
Posting Yak Master
101 Posts |
Posted - 2006-03-13 : 11:49:28
|
| Hi Guys,I am trying to update the table, here is my inline sql code.when i run this code it is not updating the table instead it is giving error message. Could you guys help me with this. appreciate your helpsql = "update tblteams set pkid = '" & Replace(Me.txtpkid.Text, "'", "''") & "', description = '" & Replace(Me.txtdescription.Text, "'", "''") & "' WHERE pkid = " & Me.txtpkid.Text & ""Thanks, |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-03-13 : 12:35:34
|
| sql = "update tblteams set pkid = '" & Replace(Me.txtpkid.Text, "'", "''") & "', description = '" & Replace(Me.txtdescription.Text, "'", "''") & "' WHERE pkid = '" & Replace(Me.txtpkid.Text, "'", "''") & "'"Missing quotes around the string in the where clause and you are allowing for embedded quotes in the update.It looks like you are updating the PK which is a bad idea.In fact you are updating it to the same value? Why are you doing that?sql = "update tblteams set description = '" & Replace(Me.txtdescription.Text, "'", "''") & "' WHERE pkid = '" & Replace(Me.txtpkid.Text, "'", "''") & "'"==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-14 : 03:01:31
|
| You should print your sql string to check for the systax error.MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|