New topic: 

Documentation Demo Does Not Work for Creating MySQL Table

<http://forums.realsoftware.com/viewtopic.php?t=45545>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        simulanics          Post subject: Documentation Demo Does Not 
Work for Creating MySQL TablePosted: Sun Oct 07, 2012 1:38 pm                   
      
Joined: Sun Aug 12, 2007 10:10 am
Posts: 730
Location: Boiling Springs, SC                The example for a prepared 
statement fails to create a table in the database. Have tried numerous 
examples, all fail.


Fails...
Dim db As New MySQLCommunityServer
db.Host = txthost.Text
db.Username = txtUsername.Text
db.Password = txtPassword.Text
db.DatabaseName = txtDatabase.Text

If Not db.Connect Then Return

db.SQLExecute("CREATE table Persons( Name, Age )")

db.SQLExecute("INSERT INTO Persons(Name, Age) VALUES ( 'john', 20)")
db.SQLExecute("INSERT INTO Persons(Name, Age) VALUES ( 'john', 21)")
db.SQLExecute("INSERT INTO Persons(Name, Age) VALUES ( 'john', 22)")
db.SQLExecute("INSERT INTO Persons(Name, Age) VALUES ( 'john', 20)")
db.SQLExecute("INSERT INTO Persons(Name, Age) VALUES ( 'john', 21)")
db.SQLExecute("INSERT INTO Persons(Name, Age) VALUES ( 'john', 22)")
db.SQLExecute( "COMMIT" )

Dim ps As PreparedSQLStatement = db.Prepare("SELECT * FROM Persons WHERE Name = 
? AND Age >= ?")

ps.BindType(0, MySQLPreparedStatement.MYSQL_TYPE_STRING)
ps.BindType(1, MySQLPreparedStatement.MYSQL_TYPE_LONG)

ps.Bind(0, "john")
ps.Bind(1, 20)

Dim rs As RecordSet = ps.SQLSelect
If rs <> Nil Then
  While Not rs.EOF
  MsgBox("Name:" + rs.Field("Name").StringValue + " Age: " + 
rs.Field("Age").StringValue)
  rs.MoveNext
  Wend
Else
  If db.Error Then MsgBox(db.ErrorMessage)
End If

What is wrong with table creation? If the table is manually created, it will 
propagate with data properly...just table creation DOES NOT FUNCTION. :-(
      
_________________
Matthew A. Combatti
Real Studio 2011 r4.3
Visit Real Studio Developer's Spot!
Systems:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS
~All REAL Compatible~  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to