[Gambas-user] sqlite integer to text string problem
Greetings I have a problem - I can query a sqlite database using SELECT ssym,sclose FROM shistory where (sdate='2009-05-06') and sclose.75 and sclose .1 order by ssym,sdate; and receive the following output: AAC|0.24 AAME|0.64 AAU|0.61 ABMC|0.16 ABTL|0.5 ACLS|0.47 but when I do the same in gambas and write it out I receive AAC -1076125292 sclose is defined as a integer in the sqlite database. Can anyone tell me what function to use to convert this to a string so I can output it to a report or grid? Thank You Ivan I never saw a wild thing sorry for itself. A small bird will drop frozen dead from a bough Without ever having felt sorry for itself. -- D.H. Lawrence Linux - Live Free or Die. -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] problem with mysql
Hi everyone, I'm running Kubuntu 9.04 (Jaunty) on an Intel P4 3GHz (i386) with 1GB of RAM. I have tried the packaged Gambas2, and have also compiled the latest from source following the instructions on the website. I am getting the following error: Cannot find driver for database: MySQL. However most of my MySQL connection details have come straight from the example: MODMain.module ' Gambas module file PUBLIC $conn AS NEW Connection PUBLIC PROCEDURE Connect() $conn.Close() ' Close the connection $conn.Type = MySQL ' Type of connection $conn.Host = localhost ' Name of the server $conn.Login = root ' User's name for the connection $conn.Port = 3306' Port to use in the connection, usually 3306 $conn.Name = menagerie ' Name of the data base we want to use $conn.Password = password ' User's password $conn.Open() ' Open the connection END PUBLIC SUB Main() ' Run the Procedure to connect FMain.Visible = TRUE ' The main form of your program END FMain.class ' Gambas class file PUBLIC SUB Button1_Click() DIM $resProducts AS Result ModMain.Connect() $resProducts = ModMain.$conn.Exec(SELECT * FROM products WHERE active ='1') Button2.Text = ($resProducts!shortname) END I have loaded the gb.db extension. Any help would be greatly appreciated. Thanks Adam This message was sent using IMP, the Internet Messaging Program. -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] problem with mysql
Hi everyone, I'm running Kubuntu 9.04 (Jaunty) on an Intel P4 3GHz (i386) with 1GB of RAM. I have tried the packaged Gambas2, and have also compiled the latest from source following the instructions on the website. I am getting the following error: Cannot find driver for database: MySQL. Try mysql in lower case. -- Benoît -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] How to input quotation mark in TextBox.Text to mysql
On Wed, Apr 29, 2009 at 6:48 PM, Ron r...@cyberjunky.nl wrote: webs37 schreef: Hi all, Please help.., I have error message:Query failed: You have an error in SQL syntax, check the manual that corresponds to MySQL server version for the right syntaxto use near 'an',address='Saudi Arabia I want to input text that have a quotation mark like al Qur'an here these the syntax: syntax edit = UPDATE tbl_user set title=' TextBox32.Text ',publisher=' TextBox35.Text ',year=' TextBox33.Text ',volume=' TextBox39.Text ',colation=' ComboBox14.Text ',isbn=' TextBox53.Text ',city=' an1!id_city ',publisher=' ana3!id_log ',subject=' an2!id_log ',distribution=' ana4!id_log ',hp=' TextBox36.Text ',status=' Label159.Caption ' WHERE id=' Label92.Caption ' rsedit = connection.Exec(edit) any suggestion thx Hi, it's better to use a syntax like this, no need to put in all the quotes yourself: Exec(UPDATE tbl_user SET title = 1 WHERE id = 2, TextBox32.Text, Label92.Caption) Regards, Ron_2nd. Its works, thanks for u 2 - Jack and Ron_2nd - -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] How to create xml from table view?
Hi all, Can I create xml from table view in gambas2? and can anyone give me an example, thx Regards, webs37 -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] How to create xml from table view?
I just wrote this example for a different subject. All you need to do is to encapsule the tr related lines in a external loop for each row, then you need to include the td lines in a internal loop for each column. Obviously, you can rename the style, table, tr td, elements for those you consider more appropriate. Try the following. It is a complete different approach using the XML Writer. Try it as a console project, just make sure you the gb.xml is selected under PROJECT\PROPERTIES\COMPONENTS ' Gambas module file PUBLIC SUB Main() DIM docXML AS XmlWriter docXML = NEW XmlWriter 'this line is to save the xml document in your home folder docXML.Open(User.Home /DoctorRicky.html, TRUE) 'This part is the fancy CSS styling only is not important docXML.StartElement(style, [type, text/css]) docXML.Text(table.fancyTable {padding: 2pt; widht:100%;}) docXML.Text(th {font-weight: bold; background-color: #99; color: #00}) docXML.Text(tr.evenRow {background-color: #f5f5dc; text-align: center}) docXML.Text(tr.oddRow {background-color: #ff; text-align: center}) docXML.EndElement docXML.StartElement(table, [class, fancyTable]) 'th / is the HTML tab for the headers docXML.Element(th, Test) docXML.Element(th, Date 1) docXML.Element(th, Date 2) docXML.Element(th, Date 3) 'tr / is the tag for the rows docXML.StartElement(tr, [class, oddRow]) 'td / is the tag for the colums ' number of td / elements must be the same as the number of th / elements docXML.Element(td, LDL Fraction) docXML.Element(td, 50 ml/dl) docXML.Element(td, 100 ml/dl) docXML.Element(td, 150 ml/dl) docXML.EndElement() 'On the real life you'll prefer to handle this with a Loop Control Structure docXML.StartElement(tr, [class, evenRow]) docXML.Element(td, HDL Fraction) docXML.Element(td, 50 ml/dl) docXML.Element(td, 75 ml/dl) docXML.Element(td, 100 ml/dl) docXML.EndElement() docXML.EndElement() 'PRINT Xml.EndDocument END On Thu, May 7, 2009 at 7:05 AM, wahyu budhi web...@gmail.com wrote: Hi all, Can I create xml from table view in gambas2? and can anyone give me an example, thx Regards, webs37 -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Hello all :D Can anybody tell me how i can make a...
Hello all :D Can anybody tell me how i can make a value to calculate something only if the user put specific numbers? EXAMPLE: Dim S As String Dim i, y, N, d As Integer S = TextBox1.Text y = Len(S) N = 0 For i = 1 To y d = Val(Mid(S, i, 1)) N += d * (2 ^ (y - i)) Next TextBox2.Text = N now i want the whole string to be calculated only if d gets the values of 0 or 1 and if the user puts anything else to have a msgbox that says error. So the theme is that i want to allow the user to put in the textbox1 only 0 or 1. The problem is that if i use textbox1.text 0 then etc. , the user is allowed to put only one time the 0 so in this case that he puts 00 will give him the same error for puting for example the latter a. So i want to allow the user to put in the TextBox1 only 0 or 1 but as many times as he wants :D FOR ANY IDEAS OR ANWSERS please contact me direct to my e-mail tsopanotr...@hotmail.com THANKS IN ADVANCE (vlahonick-www.vlahonick.freehost.gr) _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Hello all :D Can anybody tell me how i can make a...
Hi Vlahonick You must use keycode in the keypress event to allow only selected ascii codes to be entered in your textbox: PUBLIC SUB TextBox2_KeyPress() SELECT CASE Key.Code CASE 48 TO 49 'for 1 and 0 'following cases are for allowing delete, tab, etc CASE Key.BackSpace CASE Key.Delete CASE Key.Tab CASE ELSE STOP EVENT END SELECT END Hope this helps Jesus vlahonick vlahonick escribió: Hello all :D Can anybody tell me how i can make a value to calculate something only if the user put specific numbers? EXAMPLE: Dim S As String Dim i, y, N, d As Integer S = TextBox1.Text y = Len(S) N = 0 For i = 1 To y d = Val(Mid(S, i, 1)) N += d * (2 ^ (y - i)) Next TextBox2.Text = N now i want the whole string to be calculated only if d gets the values of 0 or 1 and if the user puts anything else to have a msgbox that says error. So the theme is that i want to allow the user to put in the textbox1 only 0 or 1. The problem is that if i use textbox1.text 0 then etc. , the user is allowed to put only one time the 0 so in this case that he puts 00 will give him the same error for puting for example the latter a. So i want to allow the user to put in the TextBox1 only 0 or 1 but as many times as he wants :D FOR ANY IDEAS OR ANWSERS please contact me direct to my e-mail tsopanotr...@hotmail.com THANKS IN ADVANCE (vlahonick-www.vlahonick.freehost.gr) _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Hello all!!! How i can make my program to under...
Hello all!!! How i can make my program to understand when i write c is different from cl ? EXAMPLE if textbox1.text=c then textbox1.text=1 else if textbox1.text=cl then textbox1.text=2 end if end if The problem is that when i am trying to write cl the result i get is 1l and this because the program doesnt understand that i want to the result 1 ONLY if i write c and the result 2 when i write both letters. I tried to fixed it with the Len argument but i didnt make it. Any ideas how i can do that with the select case or somehow? Of course it will be fixed easy if instead of cl i put Cl but in the program i want to create this is not an option because i will use more elements starting with the c latter and i cant obligate the user to have many instructions how to use the program.For example to say to the user if u want a correct result wirte c but if u want to write cl write Cl or if u want to write cs write sc. Thanks u all in advance!!! :D Please for ANY IDEAS contact me at tsopanotr...@hotmail.com :D regards vlahonick _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Hello all!!! How i can make my program to under...
Where are you checking this? Key press event. I would wait for another key like the return key. And then check. if key.code = key.return then if textbox1.text=c then textbox1.text=1 else if textbox1.text=cl then textbox1.text=2 end if end if end if this will tell the computer that the user has finished inputing. On Thu, 2009-05-07 at 20:18 +0300, vlahonick vlahonick wrote: Hello all!!! How i can make my program to understand when i write c is different from cl ? EXAMPLE if textbox1.text=c then textbox1.text=1 else if textbox1.text=cl then textbox1.text=2 end if end if The problem is that when i am trying to write cl the result i get is 1l and this because the program doesnt understand that i want to the result 1 ONLY if i write c and the result 2 when i write both letters. I tried to fixed it with the Len argument but i didnt make it. Any ideas how i can do that with the select case or somehow? Of course it will be fixed easy if instead of cl i put Cl but in the program i want to create this is not an option because i will use more elements starting with the c latter and i cant obligate the user to have many instructions how to use the program.For example to say to the user if u want a correct result wirte c but if u want to write cl write Cl or if u want to write cs write sc. Thanks u all in advance!!! :D Please for ANY IDEAS contact me at tsopanotr...@hotmail.com :D regards vlahonick _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Hello all!!! How i can make my program to under...
Probably the issue here is the event in which your code is. When Gambas recognize the 'c' it changes .text to 1, that is why you are getting the 1l, What is the event you are using to perform the textbox validation? Try to change your validation code to the LostFocus() event. Probably will work better. On Thu, May 7, 2009 at 11:18 AM, vlahonick vlahonick tsopanotr...@hotmail.com wrote: Hello all!!! How i can make my program to understand when i write c is different from cl ? EXAMPLE if textbox1.text=c then textbox1.text=1 else if textbox1.text=cl then textbox1.text=2 end if end if The problem is that when i am trying to write cl the result i get is 1l and this because the program doesnt understand that i want to the result 1 ONLY if i write c and the result 2 when i write both letters. I tried to fixed it with the Len argument but i didnt make it. Any ideas how i can do that with the select case or somehow? Of course it will be fixed easy if instead of cl i put Cl but in the program i want to create this is not an option because i will use more elements starting with the c latter and i cant obligate the user to have many instructions how to use the program.For example to say to the user if u want a correct result wirte c but if u want to write cl write Cl or if u want to write cs write sc. Thanks u all in advance!!! :D Please for ANY IDEAS contact me at tsopanotr...@hotmail.com :D regards vlahonick _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] How to create xml from table view?
On Thu, May 7, 2009 at 8:19 PM, Sergio A. Hernandez info.g...@gmail.comwrote: I just wrote this example for a different subject. All you need to do is to encapsule the tr related lines in a external loop for each row, then you need to include the td lines in a internal loop for each column. Obviously, you can rename the style, table, tr td, elements for those you consider more appropriate. Try the following. It is a complete different approach using the XML Writer. Try it as a console project, just make sure you the gb.xml is selected under PROJECT\PROPERTIES\COMPONENTS ' Gambas module file PUBLIC SUB Main() DIM docXML AS XmlWriter docXML = NEW XmlWriter 'this line is to save the xml document in your home folder docXML.Open(User.Home /DoctorRicky.html, TRUE) 'This part is the fancy CSS styling only is not important docXML.StartElement(style, [type, text/css]) docXML.Text(table.fancyTable {padding: 2pt; widht:100%;}) docXML.Text(th {font-weight: bold; background-color: #99; color: #00}) docXML.Text(tr.evenRow {background-color: #f5f5dc; text-align: center}) docXML.Text(tr.oddRow {background-color: #ff; text-align: center}) docXML.EndElement docXML.StartElement(table, [class, fancyTable]) 'th / is the HTML tab for the headers docXML.Element(th, Test) docXML.Element(th, Date 1) docXML.Element(th, Date 2) docXML.Element(th, Date 3) 'tr / is the tag for the rows docXML.StartElement(tr, [class, oddRow]) 'td / is the tag for the colums ' number of td / elements must be the same as the number of th / elements docXML.Element(td, LDL Fraction) docXML.Element(td, 50 ml/dl) docXML.Element(td, 100 ml/dl) docXML.Element(td, 150 ml/dl) docXML.EndElement() 'On the real life you'll prefer to handle this with a Loop Control Structure docXML.StartElement(tr, [class, evenRow]) docXML.Element(td, HDL Fraction) docXML.Element(td, 50 ml/dl) docXML.Element(td, 75 ml/dl) docXML.Element(td, 100 ml/dl) docXML.EndElement() docXML.EndElement() 'PRINT Xml.EndDocument END emm.. ok i understand that, but I mean, I want to create xml from tableview(gb.form), from these syntax: TRY rso = connect.Exec(SELECT tbl_borrow.date,tbl_borrow.id,id_journal.journal,tbl_borrow.op,tbl_borrow.pj FROM tbl_borrow,id_journal,tbl_journal WHERE tbl_journal.id_jour= id_journal.id AND tbl_borrow.id=tbl_journal.no_id AND tbl_borrow.id_users = 1 AND tbl_borrow.status=1 AND tbl_borrow.code='j' ORDER BY tbl_borrow.date DESC, rspin!id) WITH rso tableview3.Rows.Count = 0 IF .Count 0 THEN tableview3.Columns.Count = .Fields.Count tableview3.Rows.Count = .Count ENDIF END WITH where the data result I want to exported to xml data, any suggestion, thx -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user