0
說我們有一個查詢,我將添加一些參數是否有任何可能性,以顯示與所有參數值的查詢在Visual Studio 2010
對於防爆:
SqlCommand cmd = new SqlCommand("insert into Table(UserName, Password, Country, Email) values(@UserName, @Password, @Country, @Email)", con);
cmd.Parameters.AddWithValue("@UserName", User.UserName);
cmd.Parameters.AddWithValue("@Password", User.Password);
cmd.Parameters.AddWithValue("@Country", User.Country);
cmd.Parameters.AddWithValue("@Email", User.Email);
這樣的事情。
現在我想顯示像
insert into Table(UserName, Password, Country, Email)
values('Test1', '1234', 'India', '[email protected]')
所示將是予添加的參數的值的查詢結果。
據我所知在php
的時候我們echo查詢並在瀏覽器中運行它我們會得到參數的值。但是這裏有什麼可能嗎?
那麼,我們不能查看VS 2010中的值呢? –
檢查http://stackoverflow.com/questions/265192/get-the-generated-sql-statement-from-a-sqlcommand-object – Damith