matmunn14 Posted November 4, 2008 Share Posted November 4, 2008 I've been trying to write an application that can connect to a database using Ruby and wxRuby. When I click a button I want the program to connect to a MySQL database (I'm using DBI), insert some data and then disconnect but so far I am not having any luck. Also, I'm on Windows. Here's the code that handles the connection: evt_button(22) { |event| button_save_clicked(event) } // This code is for the form with the button. def button_save_clicked(event) @sql = DBI.connect("DBI:Mysql:invoicer:localhost", "root", nil) @query = "insert into `customers` VALUES (null, '"+@name.get_value+"', '"+@addl1.get_value+"', '"+@addl2.get_value+"', '"+@suburb.get_value+", '"+@pc.get_value+"', '"+@company.get_value+"', '"+@phone.get_value+"', '"+@fax.get_value+"')" @sql.do(@query) self.destroy end Anyone have any ideas? Also I'm kind of new to Ruby so if I'm doing anything silly then please also tell me so I don't keep making the same mistakes. Quote Link to comment https://forums.phpfreaks.com/topic/131306-ruby-ruby-wxruby-and-mysql-one-not-working-correctly/ Share on other sites More sharing options...
matmunn14 Posted November 7, 2008 Author Share Posted November 7, 2008 I'm going to bump this because I need it solved. Quote Link to comment https://forums.phpfreaks.com/topic/131306-ruby-ruby-wxruby-and-mysql-one-not-working-correctly/#findComment-684397 Share on other sites More sharing options...
matmunn14 Posted November 21, 2008 Author Share Posted November 21, 2008 Come on guys I need this solved. Sorry for all the bumping as well. Quote Link to comment https://forums.phpfreaks.com/topic/131306-ruby-ruby-wxruby-and-mysql-one-not-working-correctly/#findComment-695138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.