Showing posts with label VS2005. Show all posts
Showing posts with label VS2005. Show all posts

Thursday, July 3, 2008

Division by Cucumber?

Today I let loose my latest thingy, which reads some logs and parses them into a FoxPro table. See my post on it here.

It was working fine while in the sandbox but screamed hell when I set it loose in the wild. It threw a 'DivideByZeroException' all the time. After a while of debugging and crawling through my code I ended up here:
  1. System.Data.OleDb.OleDbCommand Com = new System.Data.OleDb.OleDbCommand(Instrucions[i]);
  2. Com.Connection = conn;
  3. Com.ExecuteNonQuery();
Line 3 threw the exception... but why? The instruction looked like 'insert into tablename (Col1, Col2, Col3) values ('One','Two','Three other things added here')'.
Thing was that the first round with another table went fine and that SQLstatement was a lot more complicated! So... what gives?

Took me about 2 hours of fiddling, cursing and sniffing through my code I found out the cause:
'Col3' is a FoxPro Memofield... sheesh.. which creates the need for the corresponding 'tablename.FPT' in the directory where the free tables reside. After that it worked like a charm.

So... all the crap in the web about some complicated parameteradding and such is safely discarded. The only thing is that you should chop your strings that should go into the memofield into 255 charater pieces as FoxPro works with stringlaterals that hold 255 chars max :)

Hope I could push you a step further to enlightenment :)

Monday, June 30, 2008

nOOb

Being actually a newbie with the Visual Studio IDE I was wondering how to change my default application icon to a more favourable one... say.. nicer one. 'On with it!' I thought and sailed through the various searchengines and wondered about the great answers to the simple question:
'How can I change the shortcut icon for my Application in VS2005?'

My favourite:
Create a shortcut on Desktop and choose 'Change Icon' then choose the program you want the icon from.
The most harebrained:
Replacing the standard App.ico in the VS.
And the most obvious:
Go look in the Helpfile

And the easy one (really obtained through deduction from my Borland projects):
Go to the 'Project'-menu, choose '[Projectname] Properties' and behold the 'Application' Tab with the magic 'Resources' at the bottom, containing 'Icon'. Change that and you have a neato (or not so neato) shortcuticon :)

Prepare for more discoveries in the world of VS2005 and C# (I was looking for some decent examples for delegates... and oh boy, there are so many, yet so absolutely not-helping) :)

Bye