toolStripProgressBar & SQL [modified]
-
Hello everybody. Someone know how show on toolStripProgressBar the progress at retrive data from SQL Query? Example: SQL Structure:
CREATE TABLE [student]( [student_id] INT NOT NULL IDENTITY(1,1), [student_name] VARCHAR(50) NOT NULL, [student_lastname] VARCHAR(70) NOT NULL, [student_age] TINYINT NOT NULL, [student_since] SMALLDATETIME NOT NULL DEFAULT GETDATE(), [student_grade] TINYINT NOT NULL, [student_active] BIT NOT NULL DEFAULT 1, PRIMARY KEY( [student_data_id] ) )
CREATE TABLE [class]( [class_id] SMALLINT NOT NULL IDENTITY(1,1), [class_name] VARCHAR(50) NOT NULL, [class_acive] BIT NOT NULL DEFAULT 1, PRIMARY KEY( [class_id] ) )
CREATE TABLE [class_by_student]( [class_id] REFERENCES [class] ( [class_id] ), [student_id] REFERENCES [student]( [student_id] ), PRIMARY KEY( [class_id], [student_id] ) )
C# Code:using System; using System.Data; using System.Data.SqlClient; using System.Windows.Forms; using System.Thread; public class Form1 : Form { private System.ComponentModel.IContainer components = null; private StatusStrip sb; private ToolStripProgressBar pb; DataGridView dg; Thread Thread4LoadData; public Form1() { this.makeForm(); } public makeForm() { this.sb = new StatusStrip(); this.pb = new ToolStripProgressBar(); this.dg = new DataGridView(); ((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit(); this.sb.SuspendLayout(); this.SuspendLayout(); //status bar th
-
Hello everybody. Someone know how show on toolStripProgressBar the progress at retrive data from SQL Query? Example: SQL Structure:
CREATE TABLE [student]( [student_id] INT NOT NULL IDENTITY(1,1), [student_name] VARCHAR(50) NOT NULL, [student_lastname] VARCHAR(70) NOT NULL, [student_age] TINYINT NOT NULL, [student_since] SMALLDATETIME NOT NULL DEFAULT GETDATE(), [student_grade] TINYINT NOT NULL, [student_active] BIT NOT NULL DEFAULT 1, PRIMARY KEY( [student_data_id] ) )
CREATE TABLE [class]( [class_id] SMALLINT NOT NULL IDENTITY(1,1), [class_name] VARCHAR(50) NOT NULL, [class_acive] BIT NOT NULL DEFAULT 1, PRIMARY KEY( [class_id] ) )
CREATE TABLE [class_by_student]( [class_id] REFERENCES [class] ( [class_id] ), [student_id] REFERENCES [student]( [student_id] ), PRIMARY KEY( [class_id], [student_id] ) )
C# Code:using System; using System.Data; using System.Data.SqlClient; using System.Windows.Forms; using System.Thread; public class Form1 : Form { private System.ComponentModel.IContainer components = null; private StatusStrip sb; private ToolStripProgressBar pb; DataGridView dg; Thread Thread4LoadData; public Form1() { this.makeForm(); } public makeForm() { this.sb = new StatusStrip(); this.pb = new ToolStripProgressBar(); this.dg = new DataGridView(); ((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit(); this.sb.SuspendLayout(); this.SuspendLayout(); //status bar th
You can't. Your query starts, and it ends, there's no step in between where you get feedback from the db or, ( in a single threaded app ) where your code does anything at all.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog