Hello,
I have embedded tabcontrol in my windows form.
When filling the datagridview in the tabcontrol, as a parameter I use the value of a textbox which is on the same form but out of the tabcontrol. The rust I get is empty rows in the DataGridView.
Can anybody help me please?
Thanks
Loading
Pravin GhadgePosted Feb 2, 2012, 10:21 PM
try this,
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
dateTimePicker2.Focus();
DataSet _dataset = new DataSet();
OleDbDataAdapter oleDbAdapter1 = new OleDbDataAdapter();
oleDbAdapter1.SelectCommand = new OleDbCommand();
oleDbAdapter1.SelectCommand.Connection = conn;
oleDbAdapter1.SelectCommand.CommandText = "SELECT * from Avt where Brdog=?";
oleDbAdapter1.SelectCommand.Parameters.AddWithValue("@Brdog", textBox1.Text);
oleDbAdapter1.Fill(_dataset, "Avt");
dataGridView1.DataSource = _dataset.Tables["Avt"].DefaultView;
conn.Close();
}
}
NelPosted Feb 3, 2012, 4:41 AM
VulpesPosted Feb 2, 2012, 10:26 AM
http://www.c-sharpcorner.com/Forums/Thread/159968/no-value-given-for-one-or-more-required-parameters-error-w.aspx