Actually, you do know what's wrong: you're using an unassigned local variable. It will even tell you that strPLatitude is the culprit.
How to fix? Assign something to it, obviously. Most C# compile errors are easy like that.
You wanted a null array? Then make a null array: double strPLatitude = null;
That doesn't make the code work, I grant you, but it fixes this problem.
declared a null array but when i try to use this array to store my values
Reveals a deeper problem. You can't use something that doesn't exist. Like Richard wrote, "You must allocate some space to it before you can store anything in it". Your reply to him seems to imply you didn't really get it.
This is like saying "I have a place where a bookshelf should go but there isn't one there yet, why do things go wrong when I try to store books in it?"
Don't use something that doesn't exist. You need an actual bookshelf, not just a place where a bookshelf could go.
PIEBALDconsult suggest you use a List, you should probably do that. Be sure to Add[^] the items to the list, don't try to stuff them into positions that do not exist.
Im doing a big final project that manages a dive shop.
This application will have data base.
What im looking for is some example of solution that works with data base(connect to DB , SQL , Query) that i can take and modify it for my needs.
I understand that article is from 2007, but I'd completely disregard it. It was completely bad practice even "back then". Definitely is horrible practice today. Use a proper data access layer like EF, nHibernate, etc. At the very least, if you use barebones ADO.NET, you should not write queries in the C# code like that. Completely vulnerable to a script kiddie who knows SQL injection.
Completely vulnerable to a script kiddie who knows SQL injection
bullsh*t -- it fully and easily supports parameters so there's no reason a developer has to leave himself open to that.
EF, nHibernate, etc
And what do you think they do in the background? Exactly the same things I do. Everything has to go through a command and connection eventually; I cut out the middle man. Additionally, those tools may not support whatever database the OP has to use, whereas there is probably an ADO.net connector for it.
Last Visit: 31-Dec-99 18:00 Last Update: 19-Aug-14 18:09