I am working with "SQL Server 2000 SP3 2000.80.760.0". How to write recursive query for next example ? (I use .net c# to query database, and my knowledge of SQL is limited ...) All queries are done from the same table (lets call it "parts_table"). Let say I start with "part_ID" = 1001 --> query returns 120 "subpart_id" (1002, 1004, 2030 ...) then I execute same query 120 times and get n subparts for each of 120 subpart_ID from first query and so on until there are no subparts left. As you can see the number of queries can increase very fast ... Table: "parts_table" id part_id subpart_id 1 1001 1002 2 1001 1004 3 1002 2150 4 1002 3250 5 1004 1250 . Part description for "part_id" is in separate table "part_info". I use join to get info for "part_id" ...
peropata
Posts
-
Recursive query "SQL Server 2000" -
c# and sql recursive data queryI am working with "SQL Server 2000 SP3 2000.80.760.0" and as I understand it does not support CTE. Are there any examples for recursive query for "SQL Server 2000" ?
-
c# and sql recursive data queryAll queries are done from the same table (lets call it "parts_table"). Let say I start with "part_ID" = 1001 --> query returns 120 "subpart_id" (1002, 1004, 2030 ...) then i execute same query 120 times and get n subparts for each of 120 subpart_ID from first query and so on until there are no subparts left. As you can see the number of queries can increase very fast ... Table: "parts_table" id part_id subpart_id 1 1001 1002 2 1001 1004 3 1002 2150 4 1002 3250 5 1004 1250 . Part description for "part_id" is in separate table "part_info". I use join to get info for "part_id" ...
-
c# and sql recursive data queryHi, in my project I use:
command = new SqlCommand(SQLStatement, DataBase.SqlDataReader
reader = command.ExecuteReader();to query "part_ID" from large table. Each part_ID can have more subparts up to n level. They are all stored in same table. At the moment I use foreach statement to recursivly query parts from table until they have no sub parts. As there are up to 10000 subparts for some of parts it takes up to almost a minute to get all subparts (each query takes app. 15 ms). Is there a faster (more efficient) way to get the same job done?
-
Listview selected item backgroundcolorHi, how to change (override) selected (highlighted)listviewitem background color in listview control.
-
FlickeringI will go with "lightweight controls". I guess, I was just lazy and was looking for shortcuts. :-D
-
FlickeringI was just on my way from work, so I didn't responde earlier. I was trying to create a matrix of fields, so when you click or hover over a field some event is raised. I will probably draw the whole matrix on bitmap and use double buffering and create events based on mouse position.
-
FlickeringHi, I have a form, with 40 controls, that change size while form is resized. I tried to find solution for flickering, but none of them realy worked. (like: OnPaintBackground, protected override CreateParams CreateParams, DoubleBuffered = true ...) Is there any way to prevent this annoying flickering ?
-
Disable "close box (X button)" on child formsThanks!
-
Disable "close box (X button)" on child formsOn which event from main MDI form should I call AllowClose()? If I call it from:
private void MDIMainForm_FormClosed(object sender, FormClosedEventArgs e)
OR
private void MDIMainForm_FormClosing(object sender, FormClosedEventArgs e)
ChildForm_FormClosing() is validated first and it does not close child form.
-
Disable "close box (X button)" on child formsHi, how do I disable "close box" on child forms, but leave it functional for "MDI form". I tried:
private void ChildForm_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}it works for child forms, but it also prevents me from closing apllication (with X button) from main MDI form.
-
FTP download and bacgroundworkerSo if I understand correctly, it is better to use one background worker (or split between just a few workers).
-
FTP download and bacgroundworkerI agree it is similar, but not exactly the same. For pinging I used for loop with
PingIP.DoAsyncPing(IPadress[i]);
and it works asynchronous. I guess I could create backgroundworkers dynamically (for each ftp download) and run them asynchronous. As I am new to multithreading, I still having trouble differentiating between backgroundworker, thread, thread pool, tasks ... Basicly I want to create multithread application with different threads (tasks): 1) scan network for devices (if connected) 2) download files using ftp 3) read from files 4) processing file content 5) some actions, based upon proccessed data -
FTP download and bacgroundworkerHi, In my application, I use FTP do download single .txt file from multiple devices (up to 100 devices, each with its own IP_adress). At the moment I use single bacground worker, which contains single for loop and goes from first to last device and downloads file to local computer (size of each file up to 5 MB). Is it better to implement separate backgroudworker for each device, and download files simultaneously and what would be the best approach?
-
Computer nameHi, Is it possible to get computer name from "IP_adress" in local network.
-
Ping multiple IP adressesThank you for your answer. I will also look into "Ping.SendAsync" method, like this one http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/1627b5e9-e18c-441e-aebf-efb2a58d86a7[^]
-
Ping multiple IP adressesFor my application I can set time-out to less then 250ms, so waiting is not a issue. When using lock, does this mean the first thread that access "variable" locks the access and if other threads are trying to access same "variable" wait (like thread.sleep) until it is released?
-
Ping multiple IP adressesHi, What would be the fastest way to ping 255 IP addresses? Are there any example with using multithreading, as I am quite new to threading.
-
MultithreadingHi, I am new to multithreading, and I am considering implementing multithreading in my code. I am using MDI application with two child forms. On first child form I have all the controls and user interface (ChildForm1). Second child form is used for data analisys and drawing graphs (ChildForm2). ChildForm1 implements: 1) serial port communication (communication with microprocessor on PCB board) 2) data acquisition from intrument connected to computer (LAN) (up to 200ms for each data acquisition) 3) data processing and controls Currently I am using timer control to comminicate over serial port (10 times per second - checking the conditions), triggering data acquisition (when conditions are met) and finaly processing data and drawing graphs on another child form (real time). As I use single thread, I am experiencing some delays (application not running smoothly as it waits for comm process and data processing). What would be the right approach in setting multithread application ?
-
Panel array [modified]Here is my code: Class for drawing different shapes (selected by iSelectShape):
public class ShapeDrawing
{
private int iSelectShape = 1;public int SelectShape { get { return iSelectShape; } set { iSelectShape = value; } } public void DrawShape(Graphics g) { Rectangle r = new Rectangle(new Point(0, 0), new Size(100, 100)); switch (iSelectShape) { case 1: g.DrawEllipse(Pens.Black , r); break; case 2: g.DrawRectangle(Pens.Black, r); break; } } }
Custom panel class:
public class MyCustomPanel : Panel { public ShapeDrawing Drawing { get; set; } protected override void OnPaint(PaintEventArgs e) { // Draw the image here using e.Graphics if (Drawing != null) Drawing.DrawShape(e.Graphics); } }
And main form with one panel:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();ShapeDrawing shape1 = new ShapeDrawing(); myPanel.Drawing = shape1; shape1.SelectShape = 2; } private void myPanel\_Paint(object sender, PaintEventArgs e) { } }
and InitializeComponent
private void InitializeComponent()
{
this.myPanel = new Dynamic_controls_panel.MyCustomPanel();
this.SuspendLayout();
//
// myPanel
//
this.myPanel.BackColor = System.Drawing.Color.White;
this.myPanel.Drawing = null;
this.myPanel.Location = new System.Drawing.Point(0, 0);
this.myPanel.Name = "myPanel";
this.myPanel.Size = new System.Drawing.Size(301, 331);
this.myPanel.TabIndex = 0;
this.myPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.myPanel_Paint);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(416, 459);
this.Controls.Add(this.myPanel);
this.Name = "Form1";