[Gambas-user] How To INSERT INTO in MySQL?

abbat abbat.81 at ...787...
Mon Feb 6 09:14:34 CET 2012


I have MODmain.module with connection:

' Gambas module file
Public $Con As New Connection
'     Public Procedure Connect()
               Try
                $Con.Close()              ' Close the connection
                $Con.Type = "MySQL"       ' Type of connection
                $Con.Host = "192.168.1.100"   ' Name of the server
                $Con.Login = "user"       ' User's name for the connection
               ' $Con.Port = "3306"        ' Port to use in the connection,
usually 3306
                $Con.Name = "bd"      ' Name of the database we want to use
                $Con.Password = "123" ' User's password
                $Con.Open()               ' Open the connection          
       End
  
And I have success request in FMain:

MODMain.$Con.Exec("SELECT PointsLeft FROM base WHERE TimeCode ='" & T & "'")

So, it works as it worked on BV.NET, but next request from VB.NET I cant
make to work in Gambas:

Dim COMMAND = New MySqlCommand("INSERT INTO statistic (" & 
             "TimeCode, SessionStart, SessionEnd, Kluch, Comp) VALUES ('" &
T & "', now(), now(),'" & kluch & "','" & Nc & "')") 


I tried next:

MODMain.$Con.Exec("INSERT INTO statistic (" & 
             "TimeCode, SessionStart, SessionEnd, Kluch, Comp) VALUES ('" &
T & "', now(), now(),'" & kluch & "','" & Nc & "')") 

but it not work



GMail-79 wrote:
> 
> On Sun, 2012-02-05 at 15:45 -0800, abbat wrote:
> 
>> I cant make to work the command for MySQL which works perfect on VB.NET
>> 
>>  Dim COMMAND = New MySqlCommand("INSERT INTO statistic (" &
>>              "TimeCode, SessionStart, SessionEnd, Kluch, Comp) VALUES ('"
>> &
>> T & "', now(), now(),'" & kluch & "','" & Nc & "')")
>> 
>> How to make it work?
>> Thanks
>> 
> 
> What does your MySqlCommand class look like?
> 
> 
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://old.nabble.com/How-To-INSERT-INTO-in-MySQL--tp33268576p33269884.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list