Is it possible to have one backgroundworker complete one job, then move on to another completely different job all in the same class? If so, how? Thanks!
brainfuelmedia_
Posts
-
one backgroundworker, two jobs? -
need help resolving error in custom spHello, I've created the following stored procedure:
CREATE PROCEDURE SOM_RO_ISVALIDPRJID @strProjectID varchar(32) AS BEGIN DECLARE @intPrjID int SET NOCOUNT ON; @intPrjID = (SELECT COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID) END IF (@intPrjID = 0) RETURN 0 ELSE RETURN 1 GO
I keep getting the error: Incorrect syntax near '@intPrjID' at line 8. The line it is referring to is where I have @intPrjID = (SELECT ...) Ryan -
Cannot get datagridview to show recordsThanks to both of you. The real kicker was this.Controls.Add(objDBGridView). I had looked at that before and thought, "Nah. Couldn't be." Well, I was wrong. :D Thanks!
-
Cannot get datagridview to show recordsI'm a noob to C#, so bear with me. I have the following class and form:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Text; using System.Windows.Forms; namespace tracker { public partial class frmMain : Form { SqlConnection objDBConnection; SqlDataAdapter objDBAdapter; DataSet objDBDataSet; DataGridView objDBGridView; public frmMain() { InitializeComponent(); } private void frmMain_Load(object sender, EventArgs e) { this.objDBConnection = new SqlConnection("Server=BigHouse;Database=tracker;Trusted_Connection=yes"); try { this.objDBConnection.Open(); this.toolStripStatusLabel1.Text = "Connected to Tracker database"; } catch (Exception connerr) { this.toolStripStatusLabel1.Text = "Cannot connect to Tracker database"; } this.getProjectGridData(); /* test data */ DataRow r = this.objDBDataSet.Tables["tbl_projects_main"].Rows[0]; Console.WriteLine("num records = " + this.objDBDataSet.Tables["tbl_projects_main"].Rows.Count + " and " + r["prj_name"].ToString()); /* END test data */ this.objDBGridView = new DataGridView(); this.objDBGridView.DataSource = this.objDBDataSet.Tables["tbl_projects_main"]; this.objDBGridView.AutoGenerateColumns = true; this.objDBGridView.Location = new Point(0, 0); this.objDBGridView.Size = new Size(700, 490); this.objDBGridView.MinimumSize = new Size(700, 490); this.objDBGridView.BackgroundColor = System.Drawing.Color.AliceBlue; this.objDBGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); this.objDBGridView.Visible = true; } private void getProjectGridData() { string strSql; strSql = "SELECT * FROM dbo.tbl_projects_main"; this.objDBDataSet = new DataSet(); this.objDBAdapter = new SqlDataAdapter(); this.objDBAdapter.SelectCommand = new SqlCommand(strSql, this.objDBConnection);