|
larsp777 wrote: But I still have to save the objects somehow so I'm not really sure how that solves anything. Please explain. It'd be a translation from a database-design.
Right now, each book would be stored in a Kund? That means that you'd be "moving" the book-data when the book moves between different Kunds; it'd be saved in a different list.
If you had three lists, life could become easier; one list to hold a collection of Kunds, one to hold the Books, and one to hold a pointer to Kund/Book combinations. In SQL, it'd be something like below;
CREATE TABLE Customer
(
Id INT IDENTITY(1,1)
PRIMARY KEY (Id)
)
CREATE TABLE Book
(
Id INT IDENTITY(1,1)
PRIMARY KEY (Id)
)
CREATE TABLE LentItems
(
CustomerId INT,
BookId INT
FOREIGN KEY (CustomerId) REFERENCES Book(Id),
FOREIGN KEY (BookId) REFERENCES Book(Id)
)
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Right now, each book would be stored in a Kund? That means that you'd be
"moving" the book-data when the book moves between different Kunds; it'd be
saved in a different list.
This is how it works (as far as I know):
Every book is stored in a list BookList and every customer is saved in CustomerList;
Every customer (Kund) has it´s own list loan where references are saved to books that are borrowed by that customer.
Again, this was a project I made in Java for a University-course a while back. Been trying to transfer it to C#.
Every book (Bok in Swedish) has a reference to the customer who borrowed the book, so it "knows" who borrowed it. The savingpart worked fine in Java but maybe works differently in C#.
|
|
|
|
|
larsp777 wrote: Again, this was a project I made in Java for a University-course a while back. Been trying to transfer it to C#.
Every book (Bok in Swedish) has a reference to the customer who borrowed the book, so it "knows" who borrowed it. The savingpart worked fine in Java but maybe works differently in C#. Those references are pointers; I don't think that the XmlSerializer is going to save the private loan-list on it's own.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Those references are pointers; I don't think that the XmlSerializer is going to
save the private loan-list on it's own.
Yes, I know they are pointers. That is why you get cross-reference, isn´t it?
Still, you could be right in that this is the problem.
Edit: I think this was one thing I considered when I was trying to find the answer. Saving a list of books was no problem.
|
|
|
|
|
Does the original Java-generated have it's loan-list in the XML?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
No, I don't think I did it in XML. I saved the objects in a binary format.
|
|
|
|
|
larsp777 wrote: No, I don't think I did it in XML. I saved the objects in a binary format.
If you save a collection using the binary-formatter, then it'll also save the pointers. If you use XML, you'll have to save the relations yourself, or keep a list.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
So...what do you suggest I do...
|
|
|
|
|
Use the binaryformatter[^] to store it as binary data. It's that, or doing some extra work to have it correctly in XML.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
When you are saving objects with cross reference, then always be sure to choose the right format.
|
|
|
|
|
That´s the problem I guess, I don´t know what the right format is.
|
|
|
|
|
how can get today closing balance opening tomorrow or month using asp.net c# and sql2005 is it possible
|
|
|
|
|
Probably by explaining where these values are stored, and how you access them.
Use the best guess
|
|
|
|
|
sir
I store value in database SQL 2005 and reflect it on web form on month basis to text box with using ASP.net
|
|
|
|
|
Probably better to use an ATM. Or explain your problem properly, with information about your database scheme/object model.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
protected void Drp_Breed_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox47.Text = Drp_Breed.SelectedItem.Text;
//Drp_Breed.Items.Insert(0, "----------");
{
general objGen = new general();
DataSet ds2 = new DataSet();
string q2 = "select distinct cl_bal_young_m,cl_bal_young_f,cl_bal_adult_m,cl_bal_adult_f from AHD_09 where District='" + Drp_District.SelectedItem.Text + "' and SDVH_VPC='" + Drp_VH.SelectedItem.Text + "' and VH_CVD_Others='" + Drp_CVD.SelectedItem.Text + "'and VD='" + Drp_VD.SelectedItem.Text + "' and Other_Institution='" + Drp_Other.SelectedItem.Text + "' and name_breed='" + Drp_Breed.SelectedItem.Text + "' and name_breed='" + TextBox47.Text + "' and Date='" + DateTime.Now.AddMonths(0).Date.ToString() + "'";
SqlCommand cmd = new SqlCommand(q2, conn);
ds2 = objGen.que_exe(q2);
////District='" + Drp_District.SelectedItem.Text + "'and
conn.Open();
if (ds2.Tables[0].Rows.Count > 0)
{
TextBox1.Text = ds2.Tables[0].Rows[0]["cl_bal_young_m"].ToString();
TextBox2.Text = ds2.Tables[0].Rows[0]["cl_bal_young_f"].ToString();
TextBox3.Text = ds2.Tables[0].Rows[0]["cl_bal_adult_m"].ToString();
TextBox4.Text = ds2.Tables[0].Rows[0]["cl_bal_adult_f"].ToString();
}
conn.Close();
|
|
|
|
|
Modify your original question, and remember to format your code using the "code" button please. It'll make it easier to read and you'll get more help.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
you are not giving enough information / code snippets to help.
How are you storing the data? (structure and very small sample data would help!).
From the little information given I would suggest that you look at either LINQ sum() method or if you are using ADO.NET and T SQL I would then have a look at the SUM(columnName)
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
protected void Drp_Breed_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox47.Text = Drp_Breed.SelectedItem.Text;
//Drp_Breed.Items.Insert(0, "----------");
{
general objGen = new general();
DataSet ds2 = new DataSet();
string q2 = "select distinct cl_bal_young_m,cl_bal_young_f,cl_bal_adult_m,cl_bal_adult_f from AHD_09 where District='" + Drp_District.SelectedItem.Text + "' and SDVH_VPC='" + Drp_VH.SelectedItem.Text + "' and VH_CVD_Others='" + Drp_CVD.SelectedItem.Text + "'and VD='" + Drp_VD.SelectedItem.Text + "' and Other_Institution='" + Drp_Other.SelectedItem.Text + "' and name_breed='" + Drp_Breed.SelectedItem.Text + "' and name_breed='" + TextBox47.Text + "' and Date='" + DateTime.Now.AddMonths(0).Date.ToString() + "'";
SqlCommand cmd = new SqlCommand(q2, conn);
ds2 = objGen.que_exe(q2);
////District='" + Drp_District.SelectedItem.Text + "'and
conn.Open();
if (ds2.Tables[0].Rows.Count > 0)
{
TextBox1.Text = ds2.Tables[0].Rows[0]["cl_bal_young_m"].ToString();
TextBox2.Text = ds2.Tables[0].Rows[0]["cl_bal_young_f"].ToString();
TextBox3.Text = ds2.Tables[0].Rows[0]["cl_bal_adult_m"].ToString();
TextBox4.Text = ds2.Tables[0].Rows[0]["cl_bal_adult_f"].ToString();
}
conn.Close();
but it show only next month after insert value
|
|
|
|
|
first thing I would suggest is that you
1. put a break point on the SQL string q2
2. after stepping over it have a look at the SQL and run it in your database, does this give you the results that you are expecting?
3. purely is a nit pick I would look into having SQL Parameters, but do this after you have sorted out the exisitng query
SQL Parameters example[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I am new to learn WPF and MVVM design pattern, beginner for both. So can anyone suggest me the tutorials for WPF and MVVM design pattern in C# with examples.
Thanks in advance.
|
|
|
|
|
|
Thanks Rechard for your prompt reply.
I visited this link, but don't identify from where to start as a beginner. I just want to make clear some basic understanding and idea of WPF & MVVM. After that I will go to these links for little bit more clear about its aspects.
Once again thanks.
|
|
|
|
|
|
Thanks Rechard for your reply.
|
|
|
|