Thanks for your reply David I'm looking for something more concrete then ODBC - That's certainly what I'm going to use since the application is going to be cross platform (and the database is an MS SQL Server). But how would you create the classes responsible for holding the database-data which the UI uses?
Jan Sommer
Posts
-
Application that communicates with a database - how? -
Get Installation pathI'm pretty sure you can look that up in Windows registry... This code should get you started: http://msdn.microsoft.com/en-us/library/ms838625.aspx[^] Try searching the registry for microsoft sql-related keys and see if the path is there.
-
is it possible to genarate barcode application using vc++6.0This might be a lame answer: Isn't barcodes just some kind of a font like this? Then I guess you could write the same code you usually use to draw text, but with the barcode font instead.
-
Help in C++ neededwe also might have a little problem with "int n;" because if "input / 9" gives decimals like 6.6, it will be converted to 7. so you might want to use a double there instead of int.
-
Help in C++ neededWell I'm no math mastermind, but I think a way to solve your problem would be something like this... if(input > 9 && input < 100) { //if the input is above 9 and under 100 then we pretty sure only have 2 digits int n; n = input / 9; if(n*9 == input) { //The sum is 9 } } this only checks ONE input - you got to figure out a way to split the input by spaces and loop through it. Again, I have no clue if this is the simplest solution, but it should work
-
Application that communicates with a database - how?If you couldn't use MFC integrated database-classes, and you had to create a simple application that communicated with a database, how would you do that? Would you use for instance SOCI, and make your non-GUI classes in STL? I mean, not use CString, but std::string, and when the GUI needs it, convert the std::string to CString and vica-versa? Or would you make all the classes in MFC and add some kind of extra database layer that converts the database-output from SOCI (which then would be a std::string for instance) and make it a CString for your business-object class and then pass that class to the GUI? Please tell if I'm not explaining this well enough.
-
Is Doc/View a great architecture?thank your for your informative reply. But MVC is not used in C++ is it? I thought it was for web applications only. Do you know of any documents that describe the Doc/View architecture in a way that's not MFC/wxWidgets-specific?
-
Is Doc/View a great architecture?How come you think it's a bad design?
-
Is Doc/View a great architecture?I want to develop an application with some kind of grid like the one in Excel. I'm using wxWidgets and there's support for the Doc/View-architecture. How many of you out there are using this for c++-applications? Are there better alternatives? It's a MDI-application with very few dialogs. If that matters.
-
Which type should i use for saving a string like this: 000000-0000?Mika > Thanks a lot! That answer was very helpful. Blue_boy > You could format the integers when you show it to the user and easily insert the missing 0. But i'm convinced - i shall use varchar for SSN :)
-
Which type should i use for saving a string like this: 000000-0000?That is why i'm asking the question - i don't know. Won't the performance fall enough to take the cpr-fields datatype into consideration?
-
Which type should i use for saving a string like this: 000000-0000?Our customers are all id'ed by their social securitynumber (CPR) which is in the format 000000-0000 here in Denmark. How would you save this in the DB? The easiest way is ofcourse to save it as a string, but i'm also considering an integer-field. Does anyone know of the performance in searching when dealing with strings vs. integer fields (in a db), and would it be worth the effort to write code that converts between userinputted CPR's to integer? We are using MSSQL, and i'm programming in C# if it matters.
-
class or structBoxing occurs if you use reference types in structs.. also, if he only plans to use value types it doesn't allocate as much memory then classes... see http://msdn.microsoft.com/en-us/library/ah19swz4(VS.71).aspx for details
-
Exposing List<> outside class [modified]i'm glad to hear i'm not completely wrong.. this sure have saved me a headache..
-
Exposing List<> outside class [modified]Thanks... Didn't know of the ReadOnlyCollection but that seems reasonable to use..
-
class or structif you consider using anything else but value types , then use a class. If not, you're free to use a struct
-
Exposing List<> outside class [modified]He said he didn't know a better way :P The first solution i came up with was to add this method to class Partner:
public IEnumerator<Customer> GetCustomersEnumerator()
{
return this.cust.GetEnumerator();
}which is working just fine for retrieving all the customers with this code:
IEnumerator<Customer> alist = partners.GetCustomerEnumerator();
while(alist.MoveNext())
{
Console.WriteLine(alist.Current.someProperty);
}But in the userinterface, when a user clicks the customer (shown in a listview) i'd like to use the customer-index to retrieve the correct customer and send him to another dialog. Currently i'm only able to access each customers information and i can't pick a specific customer, since i don't have access to the list. Am i doing it all wrong? I was considering using a database which would make everything alot easier, but that would be too hard for the other students (according to my teacher :P)
-
Exposing List<> outside class [modified]You're right - should be working now.
-
Exposing List<> outside class [modified]Say i had this class:
public sealed class Partner
{
string something;
string somethingelse;
List<Customer> customers = new List<Customer>();public List<Customer> Customers { get { return customers; } }
}
Is this bad practice? If so, how can i make it right and still be able to get all the methods a List<> provides? I know i could use
class Partner : List<Customer>
but inside Customer there's two Lists so that solution won't work there. Is it really necessary that i write a custom List for each object, just to maintain good coding practice? I'm asking because my teacher says that the above example is bad OOP - and because i'm developing an application that really needs the methods a List<> provides....modified on Wednesday, November 26, 2008 8:22 AM
-
Extract certain text from a html page.scroll to the bottom of the page that i linked to :) EDIT: weird, if you come from google you can see the answer.. paste the link onto google.com and visit it from there. then scroll to the bottom.