SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

help with sqlite3

Last post 07-06-2017 11:09 PM by sbrand. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-06-2017 7:26 PM

    help with sqlite3

    Hello all. I am trying to translate my experience with SQLite in VS ( to SharpDevelop so I can use the Forms Designer as I learn Python.

    When I use ipy.exe I can import sqlite3 and type commands and generate a test database file.


    But when I try to do this in code inside my Form I am failing. The screen "blinks" and there are no errors. I've tried wrapping code in a Try Except block and using a MessageBox.Show to display the results. I haven't figured out how to step through the code or "run to a certain line" like I can in VS but even surrouding code with message boxes to show me where I am in the code does not help me. When I start typing sqlite3 I do not get any hints at code completion which leads me to suspect maybe the module is not being installed. I did import Ironpython.SQlite.

    I have been able to add a reference to a third-party .Net grid control and it appears on the Form! In VS I could use a SQlitedataadapter to create a dataset and bind that to the grid. I'm hoping to be able to do the same with Python as I learn the language.

    I've searched and read a LOT but simply cannot get this to work. Can anyone give me any tips or list some things that are common errors that I might be doing?

    Thanks very much in advance.


    Filed under: , ,
  • 07-06-2017 9:23 PM In reply to

    Re: help with sqlite3

    I'm hoping someone is reading this who knows more than me about sqlite and Python (which isn't difficult seeing as I've never used either), but my rather generic suggesion would be...

    As you appear to already have a working project written in which uses sqlite, take a copy of it (I'd copy the entire solution folder, .sln file, project, code files and all, just in case anything you do in SharpDevelop breaks it, it probably won't but there's no harm in erring on the side of caution), and then open the copy of the solution file in SharpDevelop (it should be able to open Visual Studio solutions).

    Are you able to open the solution file? Does SharpDevelop report any errors when opening the solution file? Are all the projects in the solution showing in the solution explorer? Does it build? Does it do what you're expecting when you run it? Can you debug it and do the things you'd normally be able to do in a debugger?

    Doing this will tell us whether SharpDevelop is playing nicely with sqlite.

    If all the above works, then the problem is probably with Python or SharpDevelop or how the two interact with each other. So I'd suggest building a Python project from the ground up, i.e start with a "hello world" project and check whether it builds and runs and whether you can debug it, and gradually add to it until you find that either your app can happily talk to sqlite databases or until you find the feature that doesn't work.

    Sorry, this is a rather generic and uninformed reply, but I hope it's better than no reply at all :-)


  • 07-06-2017 11:09 PM In reply to

    Re: help with sqlite3

    Thanks Simon--any reply at my stage is better than none <G>.

    So here is an update. I copied a working VS solution as you suggested. I had to edit the app.confg file  (I think that was the one) to eliminate an error and suprisingly the app opened in SharpDevelop. I did not test it extensively but it did import a .CSV file and populate a grid (that third party control I alluded to above). There were no SQLite errors. But the code for the GUI obviously wasn't there in Python.

    I added this to the file: import IronPython.SQLite as sqlite3   (in my app where I'm testing SQLite use)

    I added this to the file:


    import IronPython.SQLite

    Now back in my app I CAN access and print out the contents of a SQLite table using the print command. I'm thinking that I'm pretty close. Maybe use cursor and loop through the rows to populate the grid but to access the SQLite methods I need to type:     cnn = sqlite3.PythonSQLite.connect(con_str) for example. And I can't seem to import the third party control so I can access the properties and methods of that object so I might need to try and use the DataGridView from MS. I don't use that usually so it will be something else to learn.

    I'm much further along, surprised that I got this far but still have struggling using the commands under SQLite since I depend a lot on the Intellisence in VS.

    But I'm going to keep trying....<G>.

    Thanks again for your rapid reply and time.



Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this ( email address.