public void run() { Exception exp = null; string selectSQL = "SELECT * FROM Employees WHERE EmployeeId = ? AND FirstName = ?"; OleDbDataAdapter oleDBda = new OleDbDataAdapter(); oleDBda.SelectCommand = new OleDbCommand(selectSQL, new OleDbConnection()); IDataParameter[] Idp = oleDBda.GetFillParameters(); try { BeginCase("Length"); Compare(Idp.Length, 0); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } oleDBda.SelectCommand.Parameters.Add(new OleDbParameter("@EmployeeId", DbType.Int32)); oleDBda.SelectCommand.Parameters["@EmployeeId"].SourceColumn = "EmployeeId"; oleDBda.SelectCommand.Parameters.Add(new OleDbParameter("@FirstName", OleDbType.VarWChar, 10)); Idp = oleDBda.GetFillParameters(); try { BeginCase("Parameter 0"); Compare(Idp[0], oleDBda.SelectCommand.Parameters[0]); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } try { BeginCase("Parameter 1"); Compare(Idp[1], oleDBda.SelectCommand.Parameters[1]); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } }
public IDataParameter[] GetFillParameters() { IDataParameter[] ida; if (SDA != null) { ida = SDA.GetFillParameters(); } else { ida = ODA.GetFillParameters(); } return(ida); }
private bool readDB(string sqlcmd) { bool op_result = false; using (OleDbDataAdapter adapter = new OleDbDataAdapter(sqlcmd, conn)) { try { Console.WriteLine(adapter.ToString()); Console.WriteLine(adapter.GetFillParameters()); } catch (Exception e) { Console.WriteLine(e); } } return(op_result); }