0

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!

2
Contributors
2
Replies
5
Views
8 Years
Discussion Span
Last Post by history84084
0

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;
    }

Edited by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.