|
|
Help Needed
Started by rodj at 08-30-2009 20:08. Topic has 2 replies.
 
 
|
|
Sort Posts:
|
|
|
|
08-30-2009, 20:08
|
rodj
Joined on 08-31-2009
Posts 2
|
OleDb Connect String From .Net?
|
|
|
|
|
Hi,
I just upgraded to the professional version and I've really been enjoying it. Already have a great success story of wanting to be able to search back through something I did several days ago - I knew the program I was using, did a search, it found my screenshots, got what I needed, beautiful!
Now I'm wanting to start looking into developing plugins and the like. One of the first things I want to do is automate some imports of the Timesnapper data into our overall time tracking system at my company. Much as I love Timesnapper, our crazy in-house system MUST be the final source for time data. I don't want to use the timesheet facility built in to Timesnapper because I want it to be completely automated I want to set up a scheduled task to shutdown Timesnapper (to free up the database), query the database, then restart Timesnapper.
I'm having a heck of a time figuring out how to connect to the database from .Net/C#. I finally got an ODBC connection (using System.Data.Odbc and an ODBC DSN) to "sort of" work. I say sort of because while it gives me access to all the data, I'm seeing some strange results in the DataReader that is returned, mainly "repeated" values in the Text1..Text5 columns.
Anyway, I've already read through http://forums.timesnapper.com/forums/217/ShowPost.aspx and http://forums.timesnapper.com/forums/1171/ShowPost.aspx and I'm still pretty confused. I did download IBExpert for direct queries, and it works great, but doesn't help as far as automating the data access from a .Net application. Am I correct in understanding that Timesnapper itself is written in C#? If so, could you simply post the connection string you are using in your own code? That would be really helpful! I know the code is proprietary, but I'm hoping you can help out with just the connection information.
Thanks and keep up the good work! Robert
|
|
|
|
|
Report
|
|
|
|
08-31-2009, 12:34
|
AtliB
Joined on 05-30-2006
Reykjavik / Iceland
Posts 382
|
Re: OleDb Connect String From .Net?
|
|
|
|
|
Hi Robert and thank you for your support.
We are using FirebirdClient (ADO.NET Data Provider), which you can find (and reference) in TimeSnapper's directory.
This is the connection string that you could use towards that provider:
m_cs = "Database=" + DbFilename + "; Userid=SYSDBA; Password=masterkey; ServerType=1; ForcedWrite=true; Pooling=false";
Where DbFilename normally is (can be a different location for older installations of TS): Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "TimeSnapper\\Database\\") + "TimeSnapper.fdb";
Connecting to the database: FbConnection cn = new FbConnection(m_cs); cn.Open();
Executing a command and filling a datatable: FbCommand cmd = cn.CreateCommand(); cmd.CommandText = sql; cmd.ExecuteNonQuery(); FbDataAdapter da = new FbDataAdapter(cmd); da.Fill(dt);
// don't forget to dispose - preferably in a finally clause... cmd.Dispose(); cn.Close(); cn.Dispose();
Hope that gets you started! Best of luck Atli
Check out TimeSnapper, the automatic screenshot journal at www.timesnapper.com
It runs in the background of your computer, taking screenshots of your desktop every few seconds all week long.
TimeSnapper lets you play back your week just like a movie. Use it to improve your work habits and become more productive.
|
|
|
|
|
Report
|
|
|
|
09-02-2009, 18:58
|
rodj
Joined on 08-31-2009
Posts 2
|
Re: OleDb Connect String From .Net?
|
|
|
|
|
Perfect! That's exactly what I needed. Thanks for the detailed response.
|
|
|
|
|
Report
|
|
|
|
|
TimeSnapper For... » TimeSnapper » Help Needed » OleDb Connect String From .Net?
|
|
|
|