|
Dave is correct that is not the correct way to build a parameterized query in C#. However, if you want to know where your SQL statement was getting broken.
values (" + NIF + "', " + loja + "," + bloqueador + ",'" + DataFim + "','" + lastupdate + "','" + Nome + "')
When this query is parsed it will become
values(NIF',Loja,bloqueador,'DataFim','latupdate','Nome')
Can you spot the error?
if (Object.DividedByZero == true) { Universe.Implode(); }
|
|
|
|
|
You replied to the wrong person. I got the notice you replied, the OP didn't.
|
|
|
|
|
I am building EPOS system (takeaway order software) with C# and everything went as I planed and I almost done programming it.
The application works where customers provide their Postcode when they want to order something and based on their postcode I should get a list of street names and when I select the street name I get a list of house numbers, then select the number to deliver the food to.
I noticed that all nowadays takeaways use this address finder which included in their EPOS which works with no need for internet connection.
Now the problem is: know do I build / include this address finder in my EPOS system? I do not want to use online address search in my EPOS. Do I have to use another special application to like address finder?
I am really stuck at this point and I can not go further programming my POS till I solve this address finder issue. Please help me with any peace of information you know in how to solve this issue. Thank you
|
|
|
|
|
Almost certainly, you want an online API - Google can help: Postcode to address API[^] as the databases tend to be pretty big, and companies tend to change for them (the UK database for example, is £2 per postcode area, per user, per year).
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: is £2 per postcode area, per user, per year Crikey that can add up quickly. What I found was the bastards keep changing the postcode boundaries so last years data is invalid.
Doesn't a postcode cover just a few houses in the UK?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
What is your concern? Cost?
How much is a "valid" address worth?
Is this app for yourself? (You can get free access to address finder APIs / data while in development) Would a user of your app be prepared to pay a few cents for a valid address?
I've developed address finders for call centers and shipping companies. It's part of providing a better service.
|
|
|
|
|
Hi Gerry and thank you for your reply. yes this app for myself, my EPOS will be free for some time and then will be sold for very cheap because my app is new. Therefore I might cost too much to buy an address finder app. I can not find any address database in the internet. Can you please guide me how can I access this address finder APIs / data? or do I have to develop address finder as you did? please help me. Thank you
|
|
|
|
|
|
Thank you Gerry for this information but as I understood from your explanation that I have to use online services ( PAF database and PCA Predict web services) to search for the address (list of street names and and house numbers) by its Postcode. Am I right?
I asked you this because I don't want to use online service as my EPOS will not have internet connection.
In the UK, most of EPOS don't use online services to locate addresses. Yesterday I check one computer which contains EPOS which can do address lookup but there is no address database in this PC and on the same time this PC has not internet connection But it has MS MapPoint and it has some Postcode APIs. So how this PC find the full address? does it use MapPoint to find address ?
Please help me I am confused, I would appreciate it if you answer my questions? Thank you
|
|
|
|
|
naouf10 wrote: as my EPOS will not have internet connection
How could that possibly work?
There might be a nomenclature problem but it seems that you want to create a order server where someone orders food to be picked up and/or delivered. If the person is at the shop there is no need for the person's address. If the person is not at the shop then both they and the shop must have internet access.
But other than that, for now, make them type the address in. Get everything else working and then add that.
|
|
|
|
|
Customers can phone in to make an order and their order will be saved and printed out and delivered to their home so this EPOS does not have internet access.
So that is why I am wondering how this EPOS can find the address from the postcode although there is no internet access nor address database in the PC? but this PC has Ms MaPPoint and some C# APIs.
Do you have any idea how possibly the PC can find the address? Thank you
|
|
|
|
|
naouf10 wrote: how this EPOS can find the address from the postcode although there is no internet access nor address database in the PC?
Simple then - it cannot.
The data must come from somewhere.
|
|
|
|
|
hi
cant run my C# program after installation - only if i Run as administrator.
in my setup i set the
InstallAllUsers = True
i change the app.manifest file to
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
allso i try to remove this app.manifest file and i try to change to
requestedExecutionLevel level="asInvoker" uiAccess="false" - and same problem
and after the install, when i try to run the program - The software is not running
only if i click on the exe file and run as administrator.
thanks
modified 19-Dec-15 6:13am.
|
|
|
|
|
With the information you provided, it's impossible to tell you why your app won't run.
What does your app supposed to do? What is it actually doing? Are there any error messages?
As it stands, it sounds like you've written your application so only an administrator can run it because of something your app is doing.
|
|
|
|
|
Did you rebuild the app with the second manifest?
|
|
|
|
|
Hi,
I need a help
I want to store path of selected item of Listbox in a string variable .
Example:
List Box Items:
ABC
XYZ
MNF
if I select XYZ in list box ..I should be able to store its path as D:\Music\XYZ in a string ...ex: string path=D:\Music\XYZ
Thank you
|
|
|
|
|
string sPath = string.format("D:/Music/{0}",SelectedText);
or you can use System.IO.Path.Combine().
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks For your precious comment.. but here we assumed that file root is D:/music.
What to do if the next file location is something like.. D:/Music/Old...
and some other file location like
D:Music/new
Thanks
|
|
|
|
|
Then use System.Path.Combine() as he suggested.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You can bind the ListBox (set as the 'DataSource of the ListBox) to a Dictionary:
Dictionary<string, string> LbItemsToFilePaths = new Dictionary<string, string>
{
{"ABC", @"D:\Music\XYZ"}, {"XYZ", @"D:\Music\Old\XYZ"}
};
private void Form1_Load(object sender, EventArgs e)
{
listBox1.DataSource = new BindingSource(LbItemsToFilePaths, null);
listBox1.DisplayMember = "Key";
listBox1.ValueMember = "Value";
}
string selectedFilePath;
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
selectedFilePath = listBox1.SelectedValue.ToString();
Console.WriteLine(selectedFilePath);
}
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin
|
|
|
|
|
Is there any difference between
var customer = Customers.Where(x => x.Id == id).FirstOrDefault();
and
var customer = Customers.FirstOrDefault(x => x.Id == id);
Any reason to use one over the other?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Not in this case but you need the first one if need to do intermediary steps on the filtered values.
Philippe Mori
|
|
|
|
|
Option 2 will make it look like you knew what you were doing (assuming the next person reading the code knows what they are doing).
(Getting rid of the
var would be even better (IMO) once you "intelligence" it).
|
|
|
|
|
The example that uses both 'Where and 'FirstOrDefault I believe will be slower because the call to 'Where generates a new IEnumerable (of course that is really a "schema" for evaluation ... deferred until evaluated).
Also, since there's no real need for the Where clause, why use it ?
However, if you want a faster method (assuming Customers is a List<Customer>), the (not Linq) 'Find operator is faster:
var customerFound = Customers.Find(cus => cus.Id == id);
See: [^], [^], [^]
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin
|
|
|
|
|
Good info.. Thanks
If it's not broken, fix it until it is
|
|
|
|