Sign in to follow this  

[.net] file association is not working for multicolumn listbox

This topic is 3660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, a strange problem hunting me... I am developing a win apps using C#.Net2 with sqlite (Ver. 3) as DB. In my app, i loaded some names in the listbox and made the listbox to multicolumn. It displayed those names in multi column. Then i tried to save these names to sqlite database and it saved all the names in the sqlite db. The problem is that, i have done the file association with sqlite db, say, when the names in the listbox is saved, its extension will be .abc and a specific icon will be shown for this file. But if the listbox is made to multicolumn and then i tried to save the names in the listbox, it is saved as filename.abc.joural. From where did the extension ".journal" come from???? And the icon is not showing for this file !!!. Sometimes, instead of .journal, it may be something......Anyway, the file association is not working here................ What is the reason for that ???? how can i solve this problem????

Share this post


Link to post
Share on other sites
Here is some information on SQLite journal files. I didn't really understand your question, but I suspect -- if you are troubled by journal files -- that there is a conceptual error at some much higher level. Please try explaining what you are trying to do and maybe we can help you.

Share this post


Link to post
Share on other sites
hi, In my win apps (C#2), i have a list box which lists hundreds of names. I need to save these names as a seperate file and need to reopen this file when double clicking on it. For this, i created a new sqlite database with an extension ".abc". The code is shown below:

string Path = @"C:\ABS\Database\file1.abc";
string conString = String.Format("Data Source=" + Path + ";New=True;Version=3");
sqlconn = new SQLiteConnection(conString);
sqlconn.Open();

CMD = new SQLiteCommand("CREATE TABLE tbl_Names(Names VARCHAR (200))", sqlconn);
CMD.ExecuteNonQuery();

this is the way i create a new database (here "file1.abc") with new extension ".abc" at runtime. Then saved those names in the table tbl_Names. I have done the file association for this extension ".abc" and a has set an icon for this extension. In normal case, when saved the names, it will be saved as file1.abc with an icon in our system. And can be reopened when double clicking on it. But when i made the listbox to multi column, this is not happenening????The names are saved, but .abc with .journal is comming....!!!? And the icon is not showing for this file with .abc extension??? Pls help me.......

(Also, i have used some thrid party dll (SQLite.Net) for managing sqlite3 in our C#. The namespace used is "Finisar.SQLite")

Share this post


Link to post
Share on other sites
I have no idea what the relationship between your list view and your database is, but I suspect that there is some error in your SQL or in your transaction management. If I understand correctly a journal file should only be left behind if there is an incomplete transaction on the database. This could happen if your program crashes or if the commands your are submitting to SQLite cause it to fail for one reason or another. I would recommend reviewing your SQL and transaction management. You may want to follow the database interactions in your debugger (you are using a debugger right?) and monitor the database error variables (or whatever sqlite provides).

Share this post


Link to post
Share on other sites
hi, thanks for the reply...........

May be the mistake i have done while doing transaction....Here is the way i do it in my SQLite DB...

1. Sets the Connection to SQLite DB and opens the connection
2. Create a new object of SQLite Transaction

object.BeginTrancaction
for(int i=0;i<ListBox.Items.Count;i++)
{
Insert to Table 1, each item in the listbox using SQlite command
}
Commit

3. Create another new object of SQLite Transaction
object1.BeginTrancaction

for(int i=0;i<ListBox.Items.Count;i++)
{
Insert to Table 2, each item in the listbox using SQlite command
}
Commit

4. Create another new object of SQLite Transaction
object2.BeginTrancaction

for(int i=0;i<ListBox.Items.Count;i++)
{
Insert to Table 3, each item in the listbox using SQlite command
}
Commit

Then Connection Closes.

This is the way i am saving the names to different tables in a single DB.
These are happened on a single click of a button.

Is any wrong with this????


Share this post


Link to post
Share on other sites
The order of your operations look fine to me. The problem could be that your application is throwing an error inside of one of your transactions and it never gets committed (anything that you trap could do this even an index out of bounds exception). If the transaction does not get committed you will get a journal file and your database will not update. If you are using Visual Studio try setting the debugger to break on any exception (Debug->Exceptions, check the 'thrown' column for 'Common Language Runtime Exceptions')

Share this post


Link to post
Share on other sites

This topic is 3660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this