# Include namespaces for ease of use require 'mscorlib' require 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' include System::Windows::Media include System::Data include System::Windows::Controls # Set the titles Phone.find_name("ApplicationTitle").text = "MSDN Magazine" Phone.find_name("PageTitle").text = "IronRuby & WP7" SqlConnection = System::Data::SqlClient::SqlConnection SqlCommand = System::Data::SqlClient::SqlCommand connection = SqlConnection.new('Server=localhost;Database=TestDev;User Id=sa;Password=saadmin;Persist Security Info=false') connection.Open() command = SqlCommand.new("insert into Test_PhoneApp(Login,Password) values("otisuser","otis123")",connection) command.ExecuteNonQuery() connection.Close() # Create a new text block textBlock = TextBox.new textBlock.text = "IronRuby is running on Windows Phone 7!" textBlock.foreground = SolidColorBrush.new(Colors.Green) textBlock.font_size = 48 textBlock.text_wrapping = System::Windows::TextWrapping.Wrap # Add the text block to the page Phone.find_name("ContentGrid").children.add(textBlock)