New topic: Inserting records in a new database
<http://forums.realsoftware.com/viewtopic.php?t=46967> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message Carl4 Post subject: Inserting records in a new databasePosted: Sat Feb 16, 2013 7:39 am Joined: Sat Feb 09, 2013 7:41 pm Posts: 1 Hi, I am a new beginner with RB, although have experience with VB6, and enough basic knowledge of SQL to make me dangerous. I am trying to insert data from a text file created from an existing VB application that stored TYPE (structure) records in a random file. It's all going well and have created a simple .txt sequential file of the data. I can read it fine with RB and I created a new database and added a table using the IDE. The data includes a mix of string and integer data and the following code won't let me insert any integers. ' (define, open and test for database connection, etc, etc) ' BoxRecord = New DatabaseRecord BoxRecord.Column("boxnumber") = a //<- the variable 'a' is an integer When I set up the table, I made sure this field was set to integer. All other fields defined as integer show a bug, insisting on a string value. Strings work fine. Changing the variable to str(a) makes everyting work, but this can't be right ..... Is this method specifically for string data only? Any suggestions on how I should approach this would be gratefully appreciated. Also, what is the difference between the above statement and the SQLexecute INSERT? Thanks for your patience - Carl Top JShaffer Post subject: Re: Inserting records in a new databasePosted: Sat Feb 16, 2013 8:16 am Joined: Fri Jan 23, 2009 9:18 am Posts: 103 Location: Summerfield, Florida Quote:BoxRecord = New DatabaseRecord BoxRecord.Column("boxnumber") = a //<- the variable 'a' is an integer Try BoxRecord.IntegerColumn("boxnumber") = a Jim Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- 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]
