I have searched all over for a proper manual - alas! I need to produce a Rave Report from an SQL statement in Delphi7, something like SELECT * FROM tblTransaction WHERE TransDate>=[Starting Date] And TransDate<=[End Date] ORDER BY Category, TransDate; (TransDate and Category are fields in the table) The report must look like an MS Access report GROUPED by Category, then all the Transactions in that group (Category) ordered by TransDate, followed by a sub-total for the group and, finally, an overall TOTAL for all the transactions. The transactions are invoices with such information as supplier, date paid, detail, etc. The SQL must be passed to Rave Reports from Delphi, as must be the ConnectionString to the database. There are sites advertising examples of Rave for sale but, they are not specific and I do not want to spend unless I know it's what I'm looking for. Hannes
hbez
Posts
-
RAVE REPORTS -
REFRESHING DBGRID IN D7That link opens a site were I cannot download. Could you please E-mail to hbez@mweb.co.za Much indebted to you.
-
REFRESHING DBGRID IN D7That is very kind of you, thanks.
-
REFRESHING DBGRID IN D7I deleted the ADOQuery and replaced it with an ADODataSet and the code is as you suggest:
with dsCategory do //now a DataSet
begin
Close;
ConnectionString := cnnStr; //cnnStr comes from Form1.
CommandText := 'SELECT Category,Expense FROM tblCategory ORDER BY Category';
Open;
end;No change :( Even Refresh and Repaint does not work. The grid looks like its refreshing (flashes) but the modified data is not displayed.
-
REFRESHING DBGRID IN D7All I have is an ADOQuery, an ADODataSource and a DBGrid. I tried to create the ADOQuery and DataSource programmatically but it did not work. I have not tried to do the same with the DBGrid. To my knowledge a DataSource does not have an Active, Close, Open or Refresh property, that's why I tried creating and freeing it but the data still did not change in the DBGrid.
Str := 'UPDATE tblTransaction SET tblTransaction.Category = "' + NewCat+ '", ' +
'tblTransaction.TaxDeductable="' + NewExp + '" ' +
'WHERE (((tblTransaction.Category) = "ZZZZ"));';
cmdCategory.CommandText := Str;
cmdCategory.Execute;
ShowData;//and then this bit in the ShowData procedure
with qryCategory do
begin
Active := False; //I also tried Close and Open
ConnectionString := cnnStr;
SQL.Text := 'SELECT Category,Expense FROM tblCategory ORDER BY Category';
Active := True;
end;//The DBGrid should now show this change
-
REFRESHING DBGRID IN D7I use an ADOQuery, ADODataSource and DBGrid to populate a Read-only DBGrid from an Access table. I then use an ADOCommand to execute an SQL statement to either Update, Insert or Delete a record in the table. How do I get the DBGrid to automatically display the updated table? I have tried to Refresh or Update the DBGrid, also Close and Open, and Active=False and True on the ADOQuery, all to no avail. I tried to define a TDataSource which I can Create before running the query and FreeAndNil afterwards but, I get an error 'Not enough parameters' when I do MyDataSource := TDataSource.Create. I think this approach could work? Hannes
-
Passing Image data between formsCould someone pse tell me how I may pass the following between forms: I have a form with about 50 buttons and each opens a new form displaying a jpg picture (imported into Resources) in a PictureBox. When I close the form I'm back on the original form with the many buttons. It works pretty well but I think having just one extra form is more elegant - and less work! I need to pass Image data like MyProject.Properties.Resources._142 (the pic is 142.jpg) to the form and then open it. Somewhere I saw that one can use Form dispForm = new dispForm(yProject.Properties.Resources._142) but the method does not accept a parameter. I'm starting to like this language :) Many thanks for any help. Hannes
-
Display ArrayList in ListBoxThkx for the suggestions, I am indeed wading my way thru a recently purchased 1500-page C# book - while trying to keep up with teaching, examining and marking 200 kids learning Delphi. We have been teaching Delphi at school for some time now (some schools teach Java) and forsee it making way for C#. Questions asked in exams are set so you can answer them in either Delphi or Java. I have set a typical problem - a button to add an object to an ArrayList (Delphi would use a dynamic array, I don't know how Java would handle it), and a button to display the array. Typically, a question would also have buttons to sort and to locate/delete/insert an object. The form design will be given, sometimes even the data. Learners must then make the buttons work. I know global variables defeat the aims of OOP, but I was trying to define the ArrayList as such. So, to some extent, it's not about elegant solutions at this level but rather just getting to grips with the basics. Hannes
-
Display ArrayList in ListBoxMny thkx so far :) Here's the code I'm using: class Student { string sName; string sSurname; string sID; bool bGender; double dAmount; public Student(string sN, string sS, string sI, bool bG, double dA) { sName = sN; sSurname = sS; sID = sI; bGender = bG; dAmount = dA; } public override string ToString() { return string.Format("Name: {0} Surname: {1} ID: {2} Male: {3} Account: {4}", sName, sSurname, sID, bGender, dAmount); } } private void button3_Click(object sender, EventArgs e) //Click Add button { bool g = false; if (rbBoy.Checked) g = true; //then it is a boy //Now add this student to the ArrayList ArrayList Grade10 = new ArrayList(); Grade10.Add(new Student(txtName.Text, txtSurname.Text, txtID.Text, g, Convert.ToDouble(txtAmount.Text))); } private void button2_Click(object sender, EventArgs e) //Click Show button { // ArrayList Grade10 = new ArrayList(); //I'm sure this is cannot be! foreach (Student i in Grade10) lbxShow.Items.Add(" " + i); } Hannes
-
Display ArrayList in ListBoxOn a windows for, after clicking a button, I add a class Student to an ArrayList with ArrayList Grade10 = new ArrayList(); Grade10.Add(new Student(a, b, c, d, e); //Student declared as public class elsewhere This seem to work fine. However, I then want to load the items in a Listbox when another button is clicked. I use foreach (Student i in Grade10) lbxShow.Items.Add(" " + i); I get message that Grade10 does not exist in this context. If I declare Grade10 again in this event it appears that the ArrayList is empty - program runs, no errors, empty ListBox. All samples I find refer to console apps. These work for me but I cannot sort out the windows form - my first attempt at C#, I've been using Delphi for ages. Seems I have to declare ArrayList Grade10 somewhere else (global?) so it is visible inside the second button event as well? Much appreciate someone showing me the way. Hannes