public void AddBug( Bug bug ) { string bugCommand = "INSERT " + BugTable + " (BugID,TestID,BugTitle,BugDescription,BugOwner) " + "VALUES ('" + bug.ID + "','" + bug.TestID + "','" + bug.Title + "','" + bug.Description + "','" + bug.Owner + "')"; SqlCommand cmd = new SqlCommand( bugCommand, SqlDataConnection ); cmd.ExecuteNonQuery( ); return; }
public Bug RetrieveBug(string ID) { string testBug = "SELECT * FROM " + BugTable + " WHERE BugID='" + ID + "'"; SqlCommand cmd = new SqlCommand(testBug, SqlDataConnection); SqlDataReader dataReader = cmd.ExecuteReader( ); dataReader.Read( ); Bug retrievedBug = new Bug( ); retrievedBug.ID = dataReader["BugID"].ToString( ); retrievedBug.TestID = dataReader["TestID"].ToString( ); retrievedBug.Title = dataReader["BugTitle"].ToString( ); retrievedBug.Description = dataReader["BugDescription"].ToString( ); retrievedBug.Owner = dataReader["BugOwner"].ToString( ); dataReader.Close( ); return(retrievedBug); }
public Bug RetrieveBug( string ID ) { string testBug = "SELECT * FROM " + BugTable + " WHERE BugID='" + ID + "'"; SqlCommand cmd = new SqlCommand( testBug, SqlDataConnection ); SqlDataReader dataReader = cmd.ExecuteReader( ); dataReader.Read( ); Bug retrievedBug = new Bug( ); retrievedBug.ID = dataReader["BugID"].ToString( ); retrievedBug.TestID = dataReader["TestID"].ToString( ); retrievedBug.Title = dataReader["BugTitle"].ToString( ); retrievedBug.Description = dataReader["BugDescription"].ToString( ); retrievedBug.Owner = dataReader["BugOwner"].ToString( ); dataReader.Close( ); return retrievedBug; }