private void BindReader(string storedproc,string[] param) { clear(); reader = ppt.ParamReader(storedproc,param ); // Here searching a Branch Name and binding values in matching text box while (reader.Read()) { lbl_ID.Text = reader["BRANCH_ID"].ToString(); txt_Address.Text = reader["BRANCH_ADDRESS"].ToString(); txt_Branch_Phone.Text = reader["BRANCH_PHONE"].ToString(); txt_CST_Number.Text = reader["CST_NUMBER"].ToString(); txt_tin_number.Text = reader["TIN_NUMBER"].ToString(); cmb_Branch_Name.Text = reader["BRANCH_NAME"].ToString(); } reader.Close(); }
public SqlDataReader ParamReader(string sp, string[] pp) { if (_connection.State == ConnectionState.Open) { _connection.Close(); } _connection.ConnectionString = setConnection(); try { _connection.Open(); cmd = parameters(sp, pp, _connection);// Calls Parameters Method to load the Parameters in the command reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); } catch (Exception e) { throw new Exception(e.Message); } return reader; }
<code>
if (_connection.State == ConnectionState.Open) { _connection.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)