Tuesday, February 14, 2012

CommandText

Dim MiSQL As String = "INSERT INTO tabla1(ID,Proveedor,Tipo) VALUES (@.IDCentro,@.Proveedor,@.Tipo)"
............
cm.Parameters.Add(New SqlParameter("@.IDCentro", SqlDbType.Int, 4)).Value = 15
cm.Parameters.Add(New SqlParameter("@.Proveedor", SqlDbType.NVarChar, 50)).Value = "IBM"
cm.Parameters.Add(New SqlParameter("@.Tipo", SqlDbType.TinyInt, 1)).Value = 35

Hi friens, its possible to get the string with the vaules of parameters changed?, i mean get this string in code:

INSERT INTO tabla1(ID,Proveedor,Tipo) VALUES (15,IBM,35);

I tried with CommandText but in this string are the variables and not the values...thx a lot.

No.

You can get something similiar if you you SQL Profiler, but it'll look something like:

sp_ExecuteSQL "INSERT INTO tabla1(ID,Proveedor,Tipo) VALUES (@.IDCentro,@.Proveedor,@.Tipo)",@.IDCentruo=N'15',@.Proveedor=N'IBM',@.Tipo=N'35'

No comments:

Post a Comment