|
When you connect your database to create a report add the tables and link the added tables on the id's. Then you should be able to drag/drop fields of those tables onto the report.
I wouldn't recommend using VS2008 for creating reports though (although this one is not really complex), if you have a Crystal Reports application, that would be much better.
Do you have a full understanding of the sections in the report, because of not you should try to understand that first.
Best of luck.
V.
|
|
|
|
|
I suspect your data structure is screwed, this is what indicates the problem. If there is a new test type Test11 will you need to add another column?
HematologyId
ExamId
Test1
Test2... etc.
I would suggest you stop now and get an experienced data designer to create your database for you. It sound like you know your business (clinical laboratory), so get a professional to design your data structures (make sure he/she explains the reasons for the database design so you can learn from it). This will make it possible to create your application without continually running into data issues
As for the report you need to design a query in the database with all the required data, then design the report to present the data and finally put them together in you app by instantiating the report and passing the dataset with your query results in it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi everybody:
I am relatively new in C#, I am working with visual studio 2008, I am making an application with winforms with
reports.
I need to show in a report a details screen for a person of the database, one of the fields of a person is the
image path relative to the root of the aplication , I am using in the Report.rdlc an Image object placed in the
report with the following properties: Source = External, Value = First(Fields!picture.Value, "Personas_persona")
but the problem is that when I run the aplication the image is not show in the report.
Could somebody please help me ???
I woulds thanks any help.
REgards
Ariel
|
|
|
|
|
I'm trying to build a treeview of 4 layers, using 4 tables in the database.
Layer 1: Departments
Layer 2: Groups
Layer 3: Products
Layer 4: Barcodes
No I've had a go at getting the 4 tables in as a dataset, and tried to populate the treeview, but only the first 2 layers will show up in my tree view.
If I make layer 2 my first layer, only layer 2 and 3 will show up.
<br />
private void Load_tree()<br />
{<br />
DataSet ds = new DataSet();<br />
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CCS_HOConnectionString"].ConnectionString);<br />
SqlDataAdapter daDepts = new SqlDataAdapter("barcodePrinter_get_Departments", conn);<br />
SqlDataAdapter daGroups = new SqlDataAdapter("barcodePrinter_get_Groups", conn);<br />
SqlDataAdapter daProducts = new SqlDataAdapter("barcodePrinter_get_Products", conn);<br />
SqlDataAdapter daBarcode = new SqlDataAdapter("barcodePrinter_get_Barcode", conn);<br />
<br />
<br />
daDepts.Fill(ds, "DEPTS");<br />
daGroups.Fill(ds, "PRODGRP");<br />
daProducts.Fill(ds, "PRODUCT");<br />
daBarcode.Fill(ds, "product_barcode");<br />
<br />
<br />
ds.Relations.Add("Depts_Group", ds.Tables["DEPTS"].Columns["DEPTCODE"], ds.Tables["PRODGRP"].Columns["PGRPDEPT"]);<br />
ds.Relations.Add("Group_Product", ds.Tables["PRODGRP"].Columns["PGRPID"], ds.Tables["PRODUCT"].Columns["PRODGRP"]);<br />
ds.Relations.Add("ProdBarcode", ds.Tables["PRODUCT"].Columns["PRODCODE"], ds.Tables["product_barcode"].Columns["prodcode"]);<br />
<br />
dataGridView1.DataSource = ds.Tables["DEPTS"];<br />
dataGridView2.DataSource = ds.Tables["PRODGRP"];<br />
dataGridView3.DataSource = ds.Tables["PRODUCT"];<br />
dataGridView4.DataSource = ds.Tables["product_barcode"];<br />
<br />
foreach (DataRow dr in ds.Tables["DEPTS"].Rows)<br />
{<br />
TreeNode tn = new TreeNode(dr["DEPTSHORT"].ToString());<br />
foreach (DataRow drGroup in dr.GetChildRows("Depts_Group"))<br />
{<br />
TreeNode tnn = new TreeNode(drGroup["PGRPSHORT"].ToString());<br />
foreach (DataRow drProduct in dr.GetChildRows("Group_Product"))<br />
{<br />
TreeNode tnnn = new TreeNode(drProduct["PRODSHORT"].ToString());<br />
foreach (DataRow drBarcode in dr.GetChildRows("Product_Barcode"))<br />
{<br />
tnnn.Nodes.Add(drBarcode["barcode"].ToString());<br />
}<br />
tnn.Nodes.Add(tnnn);<br />
}<br />
tn.Nodes.Add(tnn);<br />
}<br />
trvBarcodes.Nodes.Add(tn);<br />
}<br />
trvBarcodes.ExpandAll();<br />
}<br />
I'm looking for a solution that will make all 4 layers show in the treeview.
Like
+Department 1
-+Group 1
--+Product 1
----Barcode 1
----Barcode 2
-+Group 2
--+Product 2
----Barcode 3
--+Product 3
----Barcode 4
I never know how many layers there will be within the child node, this is decided by the list in the database and that one can change.
modified 4-Nov-20 21:00pm.
|
|
|
|
|
Do a search in the articles for treeview, there are a number of strategies for this, I have done one suing the heirarchyid, there are a number using relationships in datasets and some using a single table with a calculated relationship field.
This is too big a question to be answered by a forum post!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have two methods used to compate Lists, and I would like to combine them if possible. The purpose is to ensure that all elements in two lists match.
private bool matchList_DateTime(List<DateTime> List1, List<DateTime> List2)
{
if (List1.Count != List2.Count) return false;
foreach (DateTime L1 in List1) if (!List2.Contains(L1)) return false;
return true;
}
private bool matchList_String(List<string> List1, List<string> List2)
{
if (List1.Count != List2.Count) return false;
foreach (string L1 in List1) if (!List2.Contains(L1)) return false;
return true;
}
modified on Tuesday, June 15, 2010 4:29 PM
|
|
|
|
|
An ideal candidate for generics
bool CompareLists<T>(List<T> listA, List<T> listB)
{
if (listA.Count != listB.Count)
return false;
foreach (T item in listA)
if (!listB.Contains(item))
return false;
return true;
}
Edit: I haven't optimised your code at all - just converted it to accept generics. You should probably null check both parameters - if both are null it's up to you how you want it to return. As this is nothing really to do with an actual class it may be useful to make it static and possibly an extension method if using 3.0 or above.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
That works, thank you. I was trying to find a way to pass them as IEquatables, which wasn't working out.
|
|
|
|
|
Timothy CIAN wrote: I was trying to find a way to pass them as IEquatables, which wasn't working out.
Why that?Perhaps using generic type constraints will help.
Life is a stage and we are all actors!
|
|
|
|
|
As a general List comparator, your method is flawed in one or two ways:
1. the order of items is disregarded (you may want to describe what "matching lists" is meant to mean);
2. when List1 holds duplicates, your method may return true even when List2 is not at all equivalent (even holding items that are not present in List1, or different quantities of List1 items).
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Good points. In this case, both lists contain distinct values (no duplicates).
The order is insignificant, the point of the method is to determine if all items in List A exist in List B, and no others.
|
|
|
|
|
Does it matter if the contents of those items are also identical?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Revised version...
private static bool matchList<T>(List<T> List1, List<T> List2)
{
if (List1 == null || List2 == null) return false;
if ((List1.Count == List2.Count) && (List1.Count == List1.Intersect(List2).Count()))
return true;
return false;
}
|
|
|
|
|
Revision revised... I realized that I could simply return the comparison, as it is bool.
private static bool matchList<T>(List<T> List1, List<T> List2)
{
if (List1 == null || List2 == null) return false;
return ((List1.Count == List2.Count) && (List1.Count == List1.Intersect(List2).Count()));
}
|
|
|
|
|
An interesting approach. thanks.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
|
Hello,
I am trying to add google maps in my C# application but i can't figure out how to do it because i am new in C#. I've checked all of the online tutorials but nothing comes up. I want to add google maps in the rectangle shown in the picture below. If any one can help me this would be very good for me.
http://yfrog.com/0kgoogleaep[^]
Thanks,
John
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:27am.
|
|
|
|
|
But i want to take information from the map. For example when i click in London i want to store it for later use!
|
|
|
|
|
You will need to register your URL with Google in order to use the maps API. They will provide a script block that must be included in your header.
You will also need a map canvas div, and use JS to create a new GMap2 object (with the div name as a parameter), create the icon objects you need, and use addOverlay methods to place icon instances at specific latitude/longitudes. Personally, I wrap all of these into a function that is called from BODY onLoad.
I would recommend reading the API documentation carefully. They have examples, also.
|
|
|
|
|
can you please link me with an example like this?
thanks for you help mate
|
|
|
|
|
Here is an example. Note that if you want to add markers using C#, you will need to create the entire "initialize" function in your code (that is, create C# code that writes the JavaScript code).
Hope this helps.
<html lang="en-us">
<head>
<title>Map Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://maps.google.com/maps?file=<Google will provide this>" type="text/javascript"></script>
<script type="text/javascript">
function initialize()
{
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(20, 0), 2);
map.enableScrollWheelZoom();
var redIcon = new GIcon(G_DEFAULT_ICON);
redIcon.image = "Images/RedCircle.png";
redIcon.shadow = "Images/transparent.png";
redIcon.iconSize = new GSize(32, 32);
redIcon.shadowSize = redIcon.iconSize;
redIcon.iconAnchor = new GPoint(16, 16);
map.addOverlay(new GMarker(new GLatLng(50, 110), { icon:redIcon } ));
map.addOverlay(new GMarker(new GLatLng(100, 200), { icon:redIcon } ));
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 1600px; height: 1000px"></div>
</body>
</html>
|
|
|
|
|
|
OK, this program is from a class I'm taking, it's an example out of our book. You have four classes, D inherits from C, C from B and B from A. I kind of understand how this works but I'm not sure.
Question. Is this considered a single object? Only one object is created but do the references make the other classes(or the methods within them) part of the same object?
I think I understand the rest.
1.) D is called and outputs 'D' becuase that is the method within D.
2.) Since C is virtual and it's child class D overries it, C also outputs 'D'.
3.) Since C is declared 'new' that hides C from B (I assume it also hides D from B) and therefore B outputs it own method and displays 'B'
4.) A is virtual and since its child class B overrides it, it also outputs 'B'.
Sorry, but I think my brain actually froze for a while when I was trying to figure this out and I'm just trying to see if anyone has any input or knows if I'm right.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example
{
class A
{
public virtual void M() { Console.WriteLine("A"); }
}
class B : A
{
public override void M() { Console.WriteLine("B"); }
}
class C : B
{
new public virtual void M() { Console.WriteLine("C"); }
}
class D : C
{
public override void M() { Console.WriteLine("D"); }
}
class Program
{
static void Main(string[] args)
{
D d = new D();
C c = d;
B b = c;
A a = b;
d.M();
c.M();
b.M();
a.M();
}
}
}
|
|
|
|
|
It is indeed one object, but depending on how you type the object, you're getting different methods to execute. The type you reference an object by can definitely impact what functionality is executed.
It's kind of like explicitly implementing interfaces, check this[^] out.
|
|
|
|