In my application I need to have the user select one program (item) from the collection in a listbox. This listbox click event then triggers a sql query of an existing sql server data table using the selected program (item) in the sql 'where' clause. The returned data then will fill a datagridview on the same C# form as the listbox. The selection of the listbox item works. The query and filling of the datagridview does not. Suggestions please!

Recommended Answers

All 2 Replies

Please post your code.

This is in the dataset designer. Should it be in the click-event handler?

   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    private void InitCommandCollection() {
        this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
        this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
        this._commandCollection[0].Connection = this.Connection;
        this._commandCollection[0].CommandText = "SELECT CAMPAIGN_ID, CREDIT_GRADE_PRE, SUB_GRADE, APR, ANNUAL_FEE, CREDIT_LINE, SE" +
            "GMENT, MAIL_CELL, MAILED, RESPONDED, APPROVED FROM dbo.[PROD_Mail Response] where campaign_id = cboxPickProgram.Text";
        this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.