On Sep 23, 2008, at 7:27 PM, david wrote:

> I got it to work but I had to manually put some info into the  
> database;
>
> #!/usr/bin/python
> import MySQLdb
> import MySQLdb.cursors
>
> conn = MySQLdb.Connect(
>    host='localhost', user='root',
>    passwd='atlantic', db='daboconsult',compress=1,

        I sure hope this isn't a real password!

>    cursorclass=MySQLdb.cursors.DictCursor) # <- important
> cursor = conn.cursor()
> cursor.executemany(
>      """INSERT INTO clients (clientname, rate, attn, street1, street2,
> city, stateprov, postalcode)
> VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", [("David Abbott", "15",
> "David", "street1", "street2", "city", "FL", "33309" )])
> cursor.execute("SELECT * FROM clients")
> rows = cursor.fetchall()
> cursor.close()
> conn.close()


        You could have done this in Dabo using:

ci = dabo.db.dConnectInfo(Host="localhost", yada yada yada...)
cn = dabo.db.dConnection(ci)
crs = cn.getDaboCursor()
crs.execute("insert into clients...")

> But I have some work to do, alot of bugs. First I need to figure out  
> how
> to create a new record. I can edit existing records but need a way to
> create a new one. I will play around with it and be back, thanks  
> again.

        From the UI, the code should be to call the form's new() method. A  
new blank record will be added to the local dataset. You then edit the  
values as needed, and repeat that for as many new records as you want  
to add. Then call the form's save() method to save all these changes  
to the database.


-- Ed Leafe





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to