How can I create a view in a SQL Server database with C#?

How do I create a view dynamically in SQL Server using C#?

Answers


Something like this, obviously your connection code will be different (better):

SqlConnection conn = null;
conn = new SqlConnection("yourConnectionString");
conn.Open();
string strSQLCommand = "CREATE VIEW vw_YourView AS SELECT YOurColumn FROM YourTable";
SqlCommand command = new SqlCommand(strSQLCommand, conn); 
string returnvalue = (string)command.ExecuteScalar(); 
conn.Close();

Need Your Help

Rails dumping a file as the response

ruby-on-rails

Im from a PHP background so I know this is possible. I'm not sure how to do it in rails though.

How To Convert Unicode Characters to the correct Language Characters in Java?

java unicode locale netbeans-7

I have one field in Database with varchar field in which i am storing Thai Sentence (in the form of Unicode ).