String selectCmd = "SELECT * FROM ORDERS WHERE CustomerID = @CustomerID"; SQLConnectionmyConnection=newSQLConnection("server=localhost;uid=sa;pwd=;database=Northwind"); SQLDataSetCommand myCommand = new SQLDataSetCommand(selectCmd, myConnection); myCommand.SelectCommand.Parameters.Add(new SQLParameter("@CustomerID", SQLDataType.NChar, 10)); myCommand.SelectCommand.Parameters["@CustomerID"].Value = selMaster.SelectedItem.Value ; //lblErrorMsg.Text = selMaster.SelectedItem.Value; try { DataSet ds = new DataSet(); myCommand.FillDataSet(ds, "Orders"); MyDataGrid.DataSource= ds.Tables["Orders"].DefaultView; MyDataGrid.DataBind(); } catch(Exception e) { lblErrorMsg.Text = "Fehler aufgetreten: " + e.ToString(); } |