March 13, 2006 at 10:35 am
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 help
sql = "update tblteams set pkid = '" & Replace(Me.txtpkid.Text, "'", "''") & "', description = '" & Replace(Me.txtdescription.Text, "'", "''") & "' WHERE pkid = " & Me.txtpkid.Text & ""
Thanks,
March 13, 2006 at 11:54 am
*You haven't put replace nor quotes in WHERE pkid = " & Me.txtpkid.Text & ""
assuming pkid is (n)varchar
*What connection technology are you using?
If VB6,Access... you can access the errors collection
msgbox errors(0).description should give you the root of the problem.
*test stored procedure
CREATE STORED PROCEDURE dbo.USP_MY_UPDATE_DESCRIPTION
(
@PkID varchar(20)
,@Description varchar(4000)
,@PkID varchar(20)
)
AS
SET NOCOUNT ON /*avoid roundtrip*/
UPDATE dbo.tblteams
SET Description =@Description
WHERE pkid=@PkID
-----------------------------------------------
March 14, 2006 at 10:16 am
Oops. That should have been:
and then you run it with:
EXEC (@sql)
-SQLBill
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply