ucasesoftware wrote:
no you don't undestand what i want
i do the first method
but i want to store the real one in a Array (to update another
database)
so i use always
dim cmd as new sqlcommand("Insert into (value1, value2) VALUES
(@value1, @value2)", myConnexion)
with cmd
.parameters.add("@value1", sqldbtype.nvarchar, 50).value = "me"
.parameters.add("@value2", sqldbtype.nvarchar, 50).value = "you"
end cmd
but after i do this i want to have it in a single string to store it
in a array
undertand ?
dim cmd as new sqlcommand("Insert into (value1, value2) VALUES (@value1,
@value2)", myConnexion)
dim s as string=cmd.CommandText
cmd.parameters.add("@value1", sqldbtype.nvarchar, 50).value = "me"
s.Replace("@value1", "'" & "me" & "'")
cmd.parameters.add("@value2", sqldbtype.nvarchar, 50).value = "you"
s.Replace("@value2", "'" & "you" & "'")
String s now contains "Insert into (value1, value2) VALUES ('me', 'you')"
But then you lose the safety of a parameterized query when you update the
other database.
If you're storing it in an array, you might as well store enough information
to be able to use a parameterized query again.
Andrew