C# re-using SQLCommand

How do I reuse a SQLCommand for say multiple queries?


SqlCommand mycommand = new SqlCommand("SElect * from BKLAH", myConnection);

Now I want to use mycommand again but use a different SQL query. How would I do this?


You can set CommandText property of your command, like this:

mycommand.CommandText = @"UPDATE BKLAH SET a = 5 WHERE id=@id";

Need Your Help

JavaMe: Random number generation of 14 positive digits

java java-me java-ee

I want to generate a random number of 14 positive digits only and I use the below function for it:


sql-server tsql pivot

im fairly sure i can use the PIVOT function to solve my issue, but i just can't figure it out. Any assistance would be greatly appreciated.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.